Make code to list groups for a user reuasble from SSH commands
The motivation for this refactoring is to be able to implement in a later change a new option for the 'ls-groups' command that allows to list the groups for a specific user. Change-Id: Ia5b2e330cb5a4f77ecd7de25d7d129417bf8376e Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -63,10 +63,14 @@ public class ListGroupsCommand extends BaseCommand {
|
||||
final PrintWriter stdout = toPrintWriter(out);
|
||||
try {
|
||||
final VisibleGroups visibleGroups = visibleGroupsFactory.create();
|
||||
visibleGroups.setProjects(projects);
|
||||
visibleGroups.setOnlyVisibleToAll(visibleToAll);
|
||||
visibleGroups.setGroupType(groupType);
|
||||
final GroupList groupList = visibleGroups.get();
|
||||
final GroupList groupList;
|
||||
if (!projects.isEmpty()) {
|
||||
groupList = visibleGroups.get(projects);
|
||||
} else {
|
||||
groupList = visibleGroups.get();
|
||||
}
|
||||
for (final GroupDetail groupDetail : groupList.getGroups()) {
|
||||
stdout.print(groupDetail.group.getName() + "\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user