ls-projects: new option to list all accessible projects
Add a new option '--all' to the 'ls-projects' SSH command to 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). Change-Id: I7e758e49ebff878a37f1fc550cbb63a99ea81818 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user