Allow project owner to use set-project ssh command

REST API and UI allow project owner to change the project settings so
fix inconsistency by allowing the same in the ssh command.

Change-Id: I123007629db87c1df6162cb1e56fc51bacff9631
This commit is contained in:
Hugo Arès 2017-04-11 20:59:34 -04:00
parent fe862e319f
commit 36cc6fcc92
2 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ The command is argument-safe, that is, if no argument is given the
previous settings are kept intact.
== ACCESS
Caller must be a member of the privileged 'Administrators' group.
Caller must be an owner of the given project.
== SCRIPTING
This command is intended to be used in scripts.

View File

@ -14,8 +14,6 @@
package com.google.gerrit.sshd.commands;
import com.google.gerrit.common.data.GlobalCapability;
import com.google.gerrit.extensions.annotations.RequiresCapability;
import com.google.gerrit.extensions.client.InheritableBoolean;
import com.google.gerrit.extensions.client.ProjectState;
import com.google.gerrit.extensions.client.SubmitType;
@ -37,7 +35,6 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
@CommandMetaData(name = "set-project", description = "Change a project's settings")
final class SetProjectCommand extends SshCommand {
private static final Logger log = LoggerFactory
@ -119,6 +116,9 @@ final class SetProjectCommand extends SshCommand {
@Override
protected void run() throws Failure {
if (!projectControl.isOwner()) {
throw new UnloggedFailure(1, "restricted to project owner");
}
Project ctlProject = projectControl.getProject();
Project.NameKey nameKey = ctlProject.getNameKey();
String name = ctlProject.getName();