Exemplo n.º 1
0
 public List<String> getResourceList() {
   ArrayList<String> resources = new ArrayList<>();
   for (Resource res : getCurrentConfig().getAllResources()) {
     resources.add(res.getName());
   }
   return resources;
 }
Exemplo n.º 2
0
 public List<PackageDefinition> getPackages() {
   ArrayList<PackageDefinition> packages = new ArrayList<>();
   for (PackageRepository repository : this.getCurrentConfig().getPackageRepositories()) {
     packages.addAll(repository.getPackages());
   }
   return packages;
 }
Exemplo n.º 3
0
 private List<CaseInsensitiveString> getAuthorizedUsers(AdminsConfig authorizedAdmins) {
   ArrayList<CaseInsensitiveString> users = new ArrayList<>();
   for (Admin admin : authorizedAdmins) {
     if (admin instanceof AdminRole) {
       addRoleUsers(users, admin.getName());
     } else {
       users.add(admin.getName());
     }
   }
   return users;
 }
Exemplo n.º 4
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;
  }