Allow plugins to reparent projects for non-administrators

This allows code reuse for plugins that want to reparent projects for
non-administrator users.

Change-Id: I883a0f83eb35e7c957f3f3b31a683a13aa14ff09
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-06-25 13:48:38 +02:00
parent 59ee9151ee
commit 6bbc036438

View File

@@ -60,11 +60,17 @@ public class SetParent implements RestModifyView<ProjectResource, Input> {
}
@Override
public String apply(final ProjectResource rsrc, Input input)
public String apply(ProjectResource rsrc, Input input) throws AuthException,
ResourceConflictException, ResourceNotFoundException,
UnprocessableEntityException, IOException {
return apply(rsrc, input, true);
}
public String apply(ProjectResource rsrc, Input input, boolean checkIfAdmin)
throws AuthException, ResourceConflictException,
ResourceNotFoundException, UnprocessableEntityException, IOException {
ProjectControl ctl = rsrc.getControl();
validateParentUpdate(ctl, input.parent, true);
validateParentUpdate(ctl, input.parent, checkIfAdmin);
IdentifiedUser user = (IdentifiedUser) ctl.getCurrentUser();
try {
MetaDataUpdate md = updateFactory.create(rsrc.getNameKey());