示例#1
0
 private boolean userNameListContainsAdmin(List<String> enabledUserNames) {
   for (String enabledUserName : enabledUserNames) {
     if (securityService.isUserAdmin(new Username(new CaseInsensitiveString(enabledUserName)))) {
       return true;
     }
   }
   return false;
 }
示例#2
0
  private List<UserModel> allUsersForDisplay() {
    Collection<User> users = allUsers();
    ArrayList<UserModel> userModels = new ArrayList<UserModel>();
    for (User user : users) {
      String userName = user.getName();

      ArrayList<String> roles = new ArrayList<String>();
      for (Role role : goConfigService.rolesForUser(new CaseInsensitiveString(userName))) {
        roles.add(CaseInsensitiveString.str(role.getName()));
      }

      userModels.add(
          new UserModel(
              user,
              roles,
              securityService.isUserAdmin(new Username(new CaseInsensitiveString(userName)))));
    }
    return userModels;
  }