ls-groups: Add option to only list groups that are visible to all

Change-Id: I68a9ec5397f9e314bc582844c620722641702154
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2011-09-06 13:12:53 +02:00
parent e11aeae5c0
commit 4d5f4b75aa
3 changed files with 18 additions and 0 deletions

View File

@@ -41,6 +41,9 @@ public class ListGroupsCommand extends BaseCommand {
usage = "projects for which the groups should be listed")
private final List<ProjectControl> projects = new ArrayList<ProjectControl>();
@Option(name = "--visible-to-all", usage = "to list only groups that are visible to all registered users")
private boolean visibleToAll;
@Override
public void start(final Environment env) throws IOException {
startThread(new CommandRunnable() {
@@ -57,6 +60,7 @@ public class ListGroupsCommand extends BaseCommand {
try {
final VisibleGroups visibleGroups = visibleGroupsFactory.create();
visibleGroups.setProjects(projects);
visibleGroups.setOnlyVisibleToAll(visibleToAll);
final GroupList groupList = visibleGroups.get();
for (final GroupDetail groupDetail : groupList.getGroups()) {
stdout.print(groupDetail.group.getName() + "\n");