diff --git a/Documentation/cmd-ls-projects.txt b/Documentation/cmd-ls-projects.txt index e6ef00c3c1..4c54e93fa9 100644 --- a/Documentation/cmd-ls-projects.txt +++ b/Documentation/cmd-ls-projects.txt @@ -57,6 +57,14 @@ OPTIONS --type:: Display only projects of the specified type. If not specified, defaults to `code`. Supported types: + +--all:: + Display all projects that are accessible by the calling user + account. Besides the projects that the calling user account has + been granted 'READ' access to, this includes all projects that + are owned by the calling user account (even if for these projects + the 'READ' access right is not assigned to the calling user + account). + -- `code`:: Any project likely to contain user files. diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListProjects.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListProjects.java index a240b3dd9a..d0005ceeac 100644 --- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListProjects.java +++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/commands/ListProjects.java @@ -100,6 +100,9 @@ final class ListProjects extends BaseCommand { @Option(name = "--description", aliases = {"-d"}, usage = "include description of project in list") private boolean showDescription; + @Option(name = "--all", usage = "display all projects that are accessible by the calling user") + private boolean all; + private String currentTabSeparator = DEFAULT_TAB_SEPARATOR; @Override @@ -134,7 +137,7 @@ final class ListProjects extends BaseCommand { } final ProjectControl pctl = e.controlFor(currentUser); - final boolean isVisible = pctl.isVisible(); + final boolean isVisible = pctl.isVisible() || (all && pctl.isOwner()); if (showTree) { treeMap.put(projectName.get(), new TreeNode(pctl.getProject(), isVisible)); continue; @@ -252,7 +255,8 @@ final class ListProjects extends BaseCommand { Ref ref = git.getRef(showBranch.get(i)); if (ref != null && ref.getObjectId() != null - && projectControl.controlForRef(ref.getLeaf().getName()).isVisible()) { + && (projectControl.controlForRef(ref.getLeaf().getName()).isVisible()) + || (all && projectControl.isOwner())) { result[i] = ref; } }