Merge "Allow plugins to reparent projects for non-administrators"

This commit is contained in:
Edwin Kempin
2015-06-29 13:16:55 +00:00
committed by Gerrit Code Review

View File

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