public List<String> modifiableGroupsForUser(Username userName) { if (isUserAdmin(userName)) { return goConfigService.allGroups(); } List<String> modifiableGroups = new ArrayList<String>(); for (String group : goConfigService.allGroups()) { if (isUserAdminOfGroup(userName.getUsername(), group)) { modifiableGroups.add(group); } } return modifiableGroups; }
public List<CaseInsensitiveString> viewablePipelinesFor(Username username) { List<CaseInsensitiveString> pipelines = new ArrayList<CaseInsensitiveString>(); for (String group : goConfigService.allGroups()) { if (hasViewPermissionForGroup(CaseInsensitiveString.str(username.getUsername()), group)) { pipelines.addAll(goConfigService.pipelines(group)); } } return pipelines; }