Exemplo n.º 1
0
  public List<User> getAdmins(PerunSession sess, Vo vo)
      throws InternalErrorException, PrivilegeException, VoNotExistsException {
    Utils.notNull(sess, "sess");
    vosManagerBl.checkVoExists(sess, vo);

    //  Authorization - Vo admin required
    if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo)) {
      throw new PrivilegeException(sess, "getAdmins");
    }

    return vosManagerBl.getAdmins(sess, vo);
  }
Exemplo n.º 2
0
  public List<Candidate> findCandidates(PerunSession sess, Vo vo, String searchString)
      throws InternalErrorException, VoNotExistsException, PrivilegeException {
    Utils.notNull(searchString, "searchString");
    Utils.notNull(sess, "sess");
    vosManagerBl.checkVoExists(sess, vo);

    // Authorization - Vo admin required
    if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo)) {
      throw new PrivilegeException(sess, "findCandidates");
    }

    return vosManagerBl.findCandidates(sess, vo, searchString);
  }
Exemplo n.º 3
0
  public void removeAdmin(PerunSession sess, Vo vo, User user)
      throws InternalErrorException, PrivilegeException, VoNotExistsException,
          UserNotAdminException, UserNotExistsException {
    Utils.notNull(sess, "sess");
    vosManagerBl.checkVoExists(sess, vo);
    perunBl.getUsersManagerBl().checkUserExists(sess, user);

    // Authorization - Vo admin required
    if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo)) {
      throw new PrivilegeException(sess, "deleteAdmin");
    }

    vosManagerBl.removeAdmin(sess, vo, user);
  }
Exemplo n.º 4
0
  public void deleteVo(PerunSession sess, Vo vo)
      throws VoNotExistsException, InternalErrorException, PrivilegeException,
          RelationExistsException {
    Utils.notNull(sess, "sess");

    // Authorization - only Perun admin can delete the VO
    if (!AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) {
      throw new PrivilegeException(sess, "deleteVo");
    }

    vosManagerBl.checkVoExists(sess, vo);

    vosManagerBl.deleteVo(sess, vo);
  }
Exemplo n.º 5
0
  public List<RichUser> getRichAdminsWithAttributes(PerunSession sess, Vo vo)
      throws InternalErrorException, PrivilegeException, VoNotExistsException,
          UserNotExistsException {
    Utils.notNull(sess, "sess");
    vosManagerBl.checkVoExists(sess, vo);

    //  Authorization - Vo admin required
    if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo)) {
      throw new PrivilegeException(sess, "getRichAdminsWithAttributes");
    }

    return getPerunBl()
        .getUsersManagerBl()
        .filterOnlyAllowedAttributes(sess, vosManagerBl.getRichAdminsWithAttributes(sess, vo));
  }
Exemplo n.º 6
0
  @Override
  public void addAdmin(PerunSession sess, Vo vo, Group group)
      throws InternalErrorException, PrivilegeException, AlreadyAdminException,
          VoNotExistsException, GroupNotExistsException {
    Utils.notNull(sess, "sess");
    vosManagerBl.checkVoExists(sess, vo);
    perunBl.getGroupsManagerBl().checkGroupExists(sess, group);

    // Authorization - Vo admin required
    if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo)) {
      throw new PrivilegeException(sess, "addAdmin");
    }

    vosManagerBl.addAdmin(sess, vo, group);
  }
Exemplo n.º 7
0
  public Vo updateVo(PerunSession sess, Vo vo)
      throws VoNotExistsException, InternalErrorException, PrivilegeException {
    Utils.notNull(sess, "sess");
    vosManagerBl.checkVoExists(sess, vo);

    // Authorization - Vo admin required
    if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo)) {
      throw new PrivilegeException(sess, "updateVo");
    }

    if (vo.getName().length() > 128) {
      throw new InternalErrorException("VO name is too long, >128 characters");
    }

    if (!vo.getShortName().matches("^[-_a-zA-z0-9.]{1,16}$")) {
      throw new InternalErrorException(
          "Wrong VO short name - must matches [-_a-zA-z0-9.]+ and not be longer than 16 characters.");
    }

    return vosManagerBl.updateVo(sess, vo);
  }