From 6bbc036438ed86786ebc305f84f6c3934fdf43ea Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Thu, 25 Jun 2015 13:48:38 +0200 Subject: [PATCH] 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 --- .../com/google/gerrit/server/project/SetParent.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/SetParent.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/SetParent.java index 4ff2b0fa18..3b031eea3c 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/SetParent.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/SetParent.java @@ -60,11 +60,17 @@ public class SetParent implements RestModifyView { } @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());