Interface VosManagerBl

All Known Implementing Classes:
VosManagerBlImpl

public interface VosManagerBl

VOs manager can create, delete, update and find VO.

You must get an instance of VosManager from Perun:

    PerunSession ps;
    //...
    VosManager vm = ps.getPerun().getVosManager();
 
Author:
Michal Prochazka, Slavek Licehammer
See Also:
  • Method Details

    • addMemberVo

      void addMemberVo(PerunSession sess, Vo vo, Vo memberVo) throws RelationExistsException
      Adds new relationship between vo and a member vo. If user is member in both vos, updates memberOrganizations list attribute. If user is member only in member vo, creates member in parent vo and sets memberOrganizations list attribute.
      Parameters:
      sess - session
      vo - vo
      memberVo - new member of the vo
      Throws:
      RelationExistsException - if member vo is already member of the vo
    • checkVoExists

      void checkVoExists(PerunSession sess, Vo vo) throws VoNotExistsException
      Throws:
      VoNotExistsException
    • convertSponsoredUsers

      void convertSponsoredUsers(PerunSession sess, Vo vo)
      For the given vo, creates sponsored members for each sponsored user who is a member of the given vo. Original sponsors of the users will be set to the sponsored members.
      Parameters:
      sess - session
      vo - vo where members will be converted
    • convertSponsoredUsersWithNewSponsor

      void convertSponsoredUsersWithNewSponsor(PerunSession sess, Vo vo, User newSponsor)
      For the given vo, creates sponsored members for each sponsored user who is a member of the given vo. The sponsored members will be sponsored by the given user, not by its original sponsors.
      Parameters:
      sess - session
      vo - vo where members will be converted
      newSponsor - user, who will be set as a sponsor to the sponsored members
    • createVo

      Vo createVo(PerunSession perunSession, Vo vo) throws VoExistsException
      Create new VO.
      Parameters:
      perunSession -
      vo - vo object with prefilled voShortName and voName
      Returns:
      newly created VO
      Throws:
      VoExistsException
      InternalErrorException
    • deleteVo

      void deleteVo(PerunSession perunSession, Vo vo)
      Delete VO.
      Parameters:
      perunSession -
      vo -
      Throws:
      InternalErrorException
    • deleteVo

      void deleteVo(PerunSession perunSession, Vo vo, boolean forceDelete)
      Delete VO.
      Parameters:
      perunSession -
      vo -
      forceDelete - force the deletion of the VO, regardless there are any existing entities associated with the VO (they will be deleted)
      Throws:
      InternalErrorException
    • findCandidates

      List<Candidate> findCandidates(PerunSession perunSession, Vo vo, String searchString, int maxNumOfResults)
      Finds users, who can join the Vo.
      Parameters:
      perunSession -
      vo -
      searchString - depends on the extSource of the VO, could by part of the name, email or something like that.
      maxNumOfResults - limit the maximum number of returned entries
      Returns:
      list of candidates who match the searchString
      Throws:
      InternalErrorException
    • findCandidates

      List<Candidate> findCandidates(PerunSession perunSession, Vo vo, String searchString)
      Finds users, who can join the Vo.
      Parameters:
      perunSession -
      vo - vo to be used
      searchString - depends on the extSource of the VO, could by part of the name, email or something like that.
      Returns:
      list of candidates who match the searchString
      Throws:
      InternalErrorException
    • findCandidates

      List<Candidate> findCandidates(PerunSession sess, Group group, String searchString)
      Finds users, who can join the group in Vo.
      Parameters:
      sess -
      group - group to be used
      searchString - depends on the extSource of the Group, could by part of the name, email or something like that.
      Returns:
      list of candidates who match the searchString
      Throws:
      InternalErrorException
    • getAdminGroups

      List<Group> getAdminGroups(PerunSession perunSession, Vo vo, String role)
      Get list of group administrators of the given VO.

      Supported roles: VOOBSERVER, TOPGROUPCREATOR, VOADMIN

      Parameters:
      perunSession -
      vo -
      role -
      Returns:
      List of groups, who are administrators of the Vo with supported role. Returns empty list if there is no VO group admin.
      Throws:
      InternalErrorException
    • getAdminGroups

      @Deprecated List<Group> getAdminGroups(PerunSession perunSession, Vo vo)
      Deprecated.
      Get list of group administrators of the given VO.
      Parameters:
      perunSession -
      vo -
      Returns:
      List of groups, who are administrators of the Vo. Returns empty list if there is no VO group admin.
      Throws:
      InternalErrorException
    • getAdmins

      List<User> getAdmins(PerunSession perunSession, Vo vo, String role, boolean onlyDirectAdmins)
      Get list of user administrators of specific vo for specific role. If some group is administrator of the VO, all VALID members are included in the list.

      If onlyDirectAdmins is true, return only direct users of the group for supported role.

      Supported roles: VOOBSERVER, TOPGROUPCREATOR, VOADMIN

      Parameters:
      perunSession -
      vo -
      role - supported role
      onlyDirectAdmins - if true, get only direct user administrators (if false, get both direct and indirect)
      Returns:
      list of all user administrators of the given vo for supported role
      Throws:
      InternalErrorException
    • getAdmins

      @Deprecated List<User> getAdmins(PerunSession perunSession, Vo vo)
      Deprecated.
      Get list of Vo administrators. If some group is administrator of the VO, all members are included in the list.
      Parameters:
      perunSession -
      vo -
      Returns:
      List of users, who are administrators of the Vo. Returns empty list if there is no VO admin.
      Throws:
      InternalErrorException
    • getBanById

      BanOnVo getBanById(PerunSession sess, int banId) throws BanNotExistsException
      Get ban by its id.
      Parameters:
      sess - session
      banId - ban id
      Returns:
      ban object
      Throws:
      BanNotExistsException - if ban with given id is not found
    • getBanForMember

      Optional<BanOnVo> getBanForMember(PerunSession sess, int memberId)
      Get ban for given member, if it exists.
      Parameters:
      sess - session
      memberId - member id
      Returns:
      ban object, or null if there is no ban for given member
    • getBansForUser

      List<BanOnVo> getBansForUser(PerunSession sess, int userId)
      Gets all bans for given user
      Parameters:
      sess - session
      userId - id of user
      Returns:
      list of bans for given user
    • getBansForVo

      List<BanOnVo> getBansForVo(PerunSession sess, int voId)
      Get list of all bans for vo with given id.
      Parameters:
      sess - session
      voId - vo id
      Returns:
      list of bans for given vo
    • getCompleteCandidates

      List<MemberCandidate> getCompleteCandidates(PerunSession sess, Vo vo, List<String> attrNames, String searchString)
      Finds MemberCandidates who can join the Vo.
      Parameters:
      sess - session
      vo - vo to be used
      attrNames - name of attributes to be searched
      searchString - depends on the extSource of the Vo, could by part of the name, email or something like that.
      Returns:
      list of memberCandidates who match the searchString
      Throws:
      InternalErrorException - internal error
    • getCompleteCandidates

      List<MemberCandidate> getCompleteCandidates(PerunSession sess, Vo vo, Group group, List<String> attrNames, String searchString, List<ExtSource> extSources)
      Finds MemberCandidates who can join the Group. If the given vo is not null, it searches only users who belong to this Vo or who have ues in any of given extSources.
      Parameters:
      sess - session
      vo - vo if vo is null, users are searched in whole perun, otherwise users are searched in members of given vo and in users with ues in any of given extSources
      group - group to be used
      attrNames - name of attributes to be searched
      searchString - depends on the extSource of the Vo, could by part of the name, email or something like that.
      extSources - extSources used to find candidates and possibly users
      Returns:
      list of memberCandidates who match the searchString
    • getDirectAdmins

      @Deprecated List<User> getDirectAdmins(PerunSession perunSession, Vo vo)
      Deprecated.
      Gets list of direct user administrators of the VO. 'Direct' means, there aren't included users, who are members of group administrators, in the returned list.
      Parameters:
      perunSession -
      vo -
      Throws:
      InternalErrorException
    • getDirectRichAdmins

      @Deprecated List<RichUser> getDirectRichAdmins(PerunSession perunSession, Vo vo)
      Deprecated.
      Get list of Vo administrators directly assigned to VO like RichUsers without attributes.
      Parameters:
      perunSession -
      vo -
      Returns:
      List of users, who are administrators of the Vo. Returns empty list if there is no VO admin.
      Throws:
      InternalErrorException
    • getDirectRichAdminsWithSpecificAttributes

      @Deprecated List<RichUser> getDirectRichAdminsWithSpecificAttributes(PerunSession perunSession, Vo vo, List<String> specificAttributes)
      Deprecated.
      Get list of Vo administrators, which are directly assigned (not by group membership) with specific attributes. From list of specificAttributes get all Users Attributes and find those for every RichAdmin (only, other attributes are not searched)
      Parameters:
      perunSession -
      vo -
      specificAttributes -
      Returns:
      list of RichUsers with specific attributes.
      Throws:
      InternalErrorException
    • getEnrichedBansForUser

      List<EnrichedBanOnVo> getEnrichedBansForUser(PerunSession sess, int userId, List<String> attrNames) throws AttributeNotExistsException
      Get all Enriched Bans for given User
      Parameters:
      sess - sesion
      userId - User ID
      attrNames - List of attributes, returns all attributes if null or empty
      Returns:
      List of Enriched Bans
      Throws:
      UserNotExistsException - if user not exists
      AttributeNotExistsException
    • getEnrichedBansForVo

      List<EnrichedBanOnVo> getEnrichedBansForVo(PerunSession sess, Vo vo, List<String> attrNames) throws AttributeNotExistsException
      Get all Enriched Bans for given VO and attribute names
      Parameters:
      sess - sesion
      vo - VO
      attrNames - List of attributes, returns all attributes if null or empty
      Returns:
      list of enriched bans
      Throws:
      VoNotExistsException - if vo not exists
      AttributeNotExistsException
    • getEnrichedVoById

      EnrichedVo getEnrichedVoById(PerunSession perunSession, int id) throws VoNotExistsException
      Finds existing vo by and id and returns corresponding EnrichedVo
      Parameters:
      perunSession -
      id -
      Returns:
      EnrichedVO object of requested VO, which contains its member and parent VOs
      Throws:
      VoNotExistsException
    • getEnrichedVos

      List<EnrichedVo> getEnrichedVos(PerunSession perunSession)
      Get list of all EnrichedVos
      Parameters:
      perunSession -
      Returns:
      List of EnrichedVos or empty list
    • getMemberVos

      List<Vo> getMemberVos(PerunSession sess, int voId)
      Gets all member organizations of the given vo.
      Parameters:
      sess - session
      voId - vo id
      Returns:
      list of member vos
    • getParentVos

      List<Vo> getParentVos(PerunSession sess, int memberVoId)
      Gets all organizations where given vo is direct member.
      Parameters:
      sess - session
      memberVoId - member vo id
      Returns:
      list of direct parent vos
    • getRichAdmins

      List<RichUser> getRichAdmins(PerunSession perunSession, Vo vo, String role, List<String> specificAttributes, boolean allUserAttributes, boolean onlyDirectAdmins) throws UserNotExistsException
      Get list of richUser administrators of specific vo for specific role. If some group is administrator of the VO, all VALID members are included in the list.

      Supported roles: VOOBSERVER, TOPGROUPCREATOR, VOADMIN

      If "onlyDirectAdmins" is "true", return only direct users of the vo for supported role with specific attributes. If "allUserAttributes" is "true", do not specify attributes through list and return them all in objects richUser . Ignoring list of specific attributes.

      Parameters:
      perunSession -
      vo -
      specificAttributes - list of specified attributes which are needed in object richUser
      allUserAttributes - if true, get all possible user attributes and ignore list of specificAttributes (if false, get only specific attributes)
      onlyDirectAdmins - if true, get only direct user administrators (if false, get both direct and indirect)
      Returns:
      list of RichUser administrators for the vo and supported role with attributes
      Throws:
      InternalErrorException
      UserNotExistsException
    • getRichAdmins

      @Deprecated List<RichUser> getRichAdmins(PerunSession perunSession, Vo vo)
      Deprecated.
      Get list of Vo administrators like RichUsers without attributes.
      Parameters:
      perunSession -
      vo -
      Returns:
      List of users, who are administrators of the Vo. Returns empty list if there is no VO admin.
      Throws:
      InternalErrorException
    • getRichAdminsWithAttributes

      @Deprecated List<RichUser> getRichAdminsWithAttributes(PerunSession perunSession, Vo vo) throws UserNotExistsException
      Deprecated.
      Get list of Vo administrators like RichUsers with attributes.
      Parameters:
      perunSession -
      vo -
      Returns:
      List of users, who are administrators of the Vo. Returns empty list if there is no VO admin.
      Throws:
      InternalErrorException
      UserNotExistsException
    • getRichAdminsWithSpecificAttributes

      @Deprecated List<RichUser> getRichAdminsWithSpecificAttributes(PerunSession perunSession, Vo vo, List<String> specificAttributes)
      Deprecated.
      Get list of Vo administrators with specific attributes. From list of specificAttributes get all Users Attributes and find those for every RichAdmin (only, other attributes are not searched)
      Parameters:
      perunSession -
      vo -
      specificAttributes -
      Returns:
      list of RichUsers with specific attributes.
      Throws:
      InternalErrorException
    • getVoById

      Vo getVoById(PerunSession perunSession, int id) throws VoNotExistsException
      Finds existing VO by id.
      Parameters:
      perunSession -
      id -
      Returns:
      VO with requested id or throws if the VO with specified id doesn't exist
      Throws:
      InternalErrorException
      VoNotExistsException
    • getVoByShortName

      Vo getVoByShortName(PerunSession perunSession, String shortName) throws VoNotExistsException
      Find existing VO by short name (short name is unique).
      Parameters:
      perunSession -
      shortName - short name of VO which you find (for example "KZCU")
      Returns:
      VO with requested shortName or throws if the VO with specified shortName doesn't exist
      Throws:
      InternalErrorException
      VoNotExistsException
    • getVoMembersCountsByStatus

      Map<Status,Integer> getVoMembersCountsByStatus(PerunSession sess, Vo vo)
      Returns number of vo members by their status.
      Parameters:
      sess - perun session
      vo - vo of members
      Returns:
      map of status in vo to number of vo members with the status
    • getVos

      List<Vo> getVos(PerunSession perunSession)
      Get list of all Vos.
      Parameters:
      perunSession -
      Returns:
      List of VOs or empty ArrayList
      Throws:
      InternalErrorException
    • getVosByIds

      List<Vo> getVosByIds(PerunSession perunSession, List<Integer> ids)
      Finds existing VOs by ids.
      Parameters:
      perunSession -
      ids -
      Returns:
      VOs with requested ids
      Throws:
      InternalErrorException
    • getVosByPerunBean

      List<Vo> getVosByPerunBean(PerunSession sess, Group group) throws VoNotExistsException
      Returns list of vos connected with a group
      Parameters:
      sess -
      group -
      Returns:
      list of vos connected with group
      Throws:
      InternalErrorException
      VoNotExistsException
    • getVosByPerunBean

      List<Vo> getVosByPerunBean(PerunSession sess, Member member)
      Returns list of vos connected with a member
      Parameters:
      sess -
      member -
      Returns:
      list of vos connected with member
      Throws:
      InternalErrorException
    • getVosByPerunBean

      List<Vo> getVosByPerunBean(PerunSession sess, Resource resource) throws VoNotExistsException
      Returns list of vos connected with a resource
      Parameters:
      sess -
      resource -
      Returns:
      list of vos connected with resource
      Throws:
      InternalErrorException
      VoNotExistsException
    • getVosByPerunBean

      List<Vo> getVosByPerunBean(PerunSession sess, User user)
      Returns list of vos connected with a user
      Parameters:
      sess -
      user -
      Returns:
      list of vos connected with user
      Throws:
      InternalErrorException
    • getVosByPerunBean

      List<Vo> getVosByPerunBean(PerunSession sess, Host host)
      Returns list of vos connected with a host
      Parameters:
      sess -
      host -
      Returns:
      list of vos connected with host
      Throws:
      InternalErrorException
    • getVosByPerunBean

      List<Vo> getVosByPerunBean(PerunSession sess, Facility facility)
      Returns list of vos connected with a facility
      Parameters:
      sess -
      facility -
      Returns:
      list of vos connected with facility
      Throws:
      InternalErrorException
    • getVosCount

      int getVosCount(PerunSession perunSession)
      Get count of all vos.
      Parameters:
      perunSession -
      Returns:
      count of all vos
      Throws:
      InternalErrorException
    • handleGroupLostVoRole

      void handleGroupLostVoRole(PerunSession sess, Group group, Vo vo, String role)
      Handles a group that lost a role.
      Parameters:
      sess - perun session
      group - group
      vo - virtual organization
      role - role of group in VO
      Throws:
      InternalErrorException
    • handleUserLostVoRole

      void handleUserLostVoRole(PerunSession sess, User user, Vo vo, String role)
      Handles a user that lost a role.
      Parameters:
      sess - perun session
      user - user
      vo - virtual organization
      role - role of user in VO
      Throws:
      InternalErrorException
    • isMemberBanned

      boolean isMemberBanned(PerunSession sess, int memberId)
      Information if there is a ban for member with given id.
      Parameters:
      sess - session
      memberId - member id
      Returns:
      true, if member with given id is banned, false otherwise
    • isUserInRoleForVo

      boolean isUserInRoleForVo(PerunSession session, User user, String role, Vo vo, boolean checkGroups)
      Check whether a user is in a role for a given VO, possibly checking also user's groups.
      Parameters:
      session - session
      user - user
      role - role
      vo - virtual organization
      checkGroups - check also groups of the user whether they have the role
      Returns:
      true if user is directly in role for the vo, or if "checkGroups" flag is set and at least one of the groups is in the role
      Throws:
      InternalErrorException - exception
    • removeBan

      void removeBan(PerunSession sess, int banId) throws BanNotExistsException
      Removes ban with given id.
      Parameters:
      sess - session
      banId - ban id
      Throws:
      BanNotExistsException - if there is no ban with given id
    • removeBanForMember

      void removeBanForMember(PerunSession sess, int memberId) throws BanNotExistsException
      Removes ban for member with given id.
      Parameters:
      sess - session
      memberId - member id
      Throws:
      BanNotExistsException - if there is no ban for member with given id
    • removeMemberVo

      void removeMemberVo(PerunSession sess, Vo vo, Vo memberVo) throws RelationNotExistsException
      Removes member vo from given vo. Updates memberOrganizations list attribute for those members of parent vo who came from the member vo.
      Parameters:
      sess - session
      vo - vo
      memberVo - vo to be removed
      Throws:
      RelationNotExistsException - if member vo is not a member of the vo
    • setBan

      Set given ban.
      Parameters:
      sess - session
      banOnVo - ban information, memberId, voId, validity and description are needed
      Returns:
      created ban object
      Throws:
      MemberNotExistsException
      BanAlreadyExistsException
    • updateBan

      BanOnVo updateBan(PerunSession sess, BanOnVo banOnVo)
      Update ban information. Only description and validity are updated.
      Parameters:
      sess - session
      banOnVo - updated ban
      Returns:
      updated ban object
    • updateVo

      Vo updateVo(PerunSession perunSession, Vo vo)
      Updates VO.
      Parameters:
      perunSession -
      vo -
      Returns:
      returns updated VO
      Throws:
      InternalErrorException
    • usesEmbeddedGroupRegistrations

      boolean usesEmbeddedGroupRegistrations(PerunSession sess, Vo vo)
      Returns true, if the given vo uses EMBEDDED_GROUP_APPLICATION item in its form.
      Parameters:
      sess - session
      vo - vo
      Returns:
      true, if the given vo uses EMBEDDED_GROUP_APPLICATION item in its form, false otherwise.