Interface MembersManagerImplApi

All Known Implementing Classes:
MembersManagerImpl

public interface MembersManagerImplApi
MembersManager can find members.
Author:
Michal Prochazka, Slavek Licehammer, Zora Sebestianova
  • Method Details

    • deleteMember

      void deleteMember(PerunSession perunSession, Member member) throws MemberAlreadyRemovedException
      Deletes only member data appropriated by member id.
      Parameters:
      perunSession -
      member -
      Throws:
      InternalErrorException
      MemberAlreadyRemovedException - if there are 0 rows affected by removing from DB
    • createMember

      Member createMember(PerunSession perunSession, Vo vo, User user) throws AlreadyMemberException
      Creates member entry in the database. Created member is in invalid state.
      Parameters:
      perunSession -
      vo - Vo
      user - User
      Returns:
      created member with id filled
      Throws:
      InternalErrorException
      AlreadyMemberException
    • getMemberVoId

      int getMemberVoId(PerunSession perunSession, Member member)
      Get member's VO id
      Parameters:
      perunSession -
      member -
      Returns:
      VO id
      Throws:
      InternalErrorException
    • getMemberByUserExtSource

      Member getMemberByUserExtSource(PerunSession perunSession, Vo vo, UserExtSource userExtSource) throws MemberNotExistsException
      Find member of this Vo by his login in external source
      Parameters:
      perunSession -
      vo -
      userExtSource -
      Returns:
      selected user or throws MemberNotExistsException in case the requested member doesn't exists in this Vo
      Throws:
      InternalErrorException
      MemberNotExistsException
    • getMemberById

      Member getMemberById(PerunSession perunSession, int id) throws MemberNotExistsException
      Returns member by his id.
      Parameters:
      perunSession -
      id -
      Returns:
      member
      Throws:
      InternalErrorException
      MemberNotExistsException
    • getMembersByIds

      List<Member> getMembersByIds(PerunSession perunSession, List<Integer> ids)
      Gets members by their ids. Silently skips non-existing members.
      Parameters:
      perunSession -
      ids -
      Returns:
      list of members with specified ids
      Throws:
      InternalErrorException
    • getMemberByUserId

      Member getMemberByUserId(PerunSession perunSession, Vo vo, int userId) throws MemberNotExistsException
      Returns member by his user id and vo.
      Parameters:
      perunSession -
      vo -
      userId -
      Returns:
      member
      Throws:
      InternalErrorException
      MemberNotExistsException
    • getMembersByUser

      List<Member> getMembersByUser(PerunSession sess, User user)
      Return all VO Members of the User.
      Parameters:
      sess -
      user -
      Returns:
      List of Members
      Throws:
      InternalErrorException
    • getAllMembers

      List<Member> getAllMembers(PerunSession sess)
      Get all members from all vos.
      Parameters:
      sess - session
      Returns:
      list of all members from all Vos.
    • getMembersByUserWithStatus

      List<Member> getMembersByUserWithStatus(PerunSession sess, User user, Status status)
      Return all VO Members of the User, which have specified Status in their VO.
      Parameters:
      sess -
      user -
      status -
      Returns:
      List of Members
      Throws:
      InternalErrorException
    • memberExists

      boolean memberExists(PerunSession perunSession, Member member)
      Check if member exists in underlaying data source.
      Parameters:
      perunSession -
      member -
      Returns:
      true if member exists in underlaying data source, false otherwise
      Throws:
      InternalErrorException
    • checkMemberExists

      void checkMemberExists(PerunSession perunSession, Member member) throws MemberNotExistsException
      Check if member exists in underlaying data source.
      Parameters:
      perunSession -
      member -
      Throws:
      InternalErrorException
      MemberNotExistsException
    • setStatus

      void setStatus(PerunSession sess, Member member, Status status)
      Set status of the member to specified status.
      Parameters:
      sess -
      member -
      status - new status
      Throws:
      InternalErrorException
    • getMembersByUsersIds

      List<Member> getMembersByUsersIds(PerunSession sess, List<Integer> usersIds, Vo vo)
      Convert list of users' ids into the list of members.
      Parameters:
      sess -
      usersIds -
      vo -
      Returns:
      list of members
      Throws:
      InternalErrorException
    • getMembersByUsers

      List<Member> getMembersByUsers(PerunSession sess, List<User> users, Vo vo)
      Convert list of users into the list of members.
      Parameters:
      sess -
      users -
      vo -
      Returns:
      list of members
      Throws:
      InternalErrorException
    • getMembersCount

      int getMembersCount(PerunSession sess, Vo vo)
      Returns all members from the VO (with every status).
      Parameters:
      sess -
      vo -
      Returns:
      number of members
      Throws:
      InternalErrorException
    • getMembersCount

      int getMembersCount(PerunSession sess, Vo vo, Status status)
      Returns number of Vo members with defined status.
      Parameters:
      sess -
      vo -
      status -
      Returns:
      number of members
      Throws:
      InternalErrorException
    • storePasswordResetRequest

      UUID storePasswordResetRequest(PerunSession sess, User user, String namespace, String mail, LocalDateTime validityTo)
      Store information about password reset request.
      Parameters:
      sess - PerunSession
      user - User to reset password for
      namespace - namespace to reset password in
      mail - mail address used to send request to
      validityTo - time till request is valid
      Returns:
      request's UUID to be used for validation
      Throws:
      InternalErrorException
    • createSponsoredMember

      Member createSponsoredMember(PerunSession session, Vo vo, User sponsored, User sponsor, LocalDate validityTo) throws AlreadyMemberException, AlreadySponsorException
      Creates a new member in given Vo with flag "sponsored", and linked to its sponsoring user.
      Parameters:
      session - PerunSession
      vo - vo where newly created member will be sponsored
      sponsored - user for which the new membership will be created (and also sponsored)
      sponsor - sponsor of new membership
      validityTo - time, when the sponsorship will expire
      Returns:
      sponsored member
      Throws:
      AlreadyMemberException - if user has already a membership in the vo
      AlreadySponsorException - if member is already sponsored by the sponsor
    • setSponsorshipForMember

      Member setSponsorshipForMember(PerunSession session, Member sponsoredMember, User sponsor, LocalDate validityTo) throws AlreadySponsorException
      Set member to be sponsored by sponsor. Set flag and sponsorship.
      Parameters:
      session - perun session.
      sponsoredMember - member who should be sponsored from now
      sponsor - user which will be a sponsor for member
      Returns:
      sponsored member
      Throws:
      InternalErrorException
      AlreadySponsorException - if member was already sponsored before this call
    • unsetSponsorshipForMember

      Member unsetSponsorshipForMember(PerunSession session, Member sponsoredMember)
      Unset member to not be sponsored by anybody from now. Unset flag and remove all sponsorships.
      Parameters:
      session -
      sponsoredMember - member whou shouldn't be sponsored from now
      Returns:
      member which is not sponsored any more
      Throws:
      InternalErrorException
    • addSponsor

      void addSponsor(PerunSession session, Member sponsoredMember, User sponsor) throws AlreadySponsorException
      Adds another sponsoring user for a sponsored member.
      Parameters:
      session - perun session
      sponsoredMember - member which is sponsored
      sponsor - sponsoring user
      Throws:
      InternalErrorException
      AlreadySponsorException - if member was already sponsored before this call
    • addSponsor

      void addSponsor(PerunSession session, Member sponsoredMember, User sponsor, LocalDate validity_to) throws AlreadySponsorException
      Adds another sponsoring user for a sponsored member.
      Parameters:
      session - perun session
      sponsoredMember - member which is sponsored
      sponsor - sponsoring user
      validity_to - time, when the sponsorship will expire
      Throws:
      InternalErrorException
      AlreadySponsorException - if member was already sponsored before this call
    • removeSponsor

      void removeSponsor(PerunSession sess, Member sponsoredMember, User sponsor)
      Removes a sponsoring user. In fact marks the link as inactive.
      Parameters:
      sess - perun session
      sponsoredMember - member which is sponsored
      sponsor - sponsoring user
      Throws:
      InternalErrorException
    • deleteAllSponsors

      void deleteAllSponsors(PerunSession session, Member sponsoredMember)
      Delete all existing sponsorships for defined member. This method will delete them, not just marked.
      Parameters:
      session - perun session
      sponsoredMember - member which is sponsored
      Throws:
      InternalErrorException
    • getSponsorship

      Sponsorship getSponsorship(PerunSession sess, Member sponsoredMember, User sponsor) throws SponsorshipDoesNotExistException
      For the given member and user returns their sponsorship relation object. If there is no such relation, the SponsorshipDoesNotExistException is thrown.
      Parameters:
      sess - session
      sponsoredMember - sponsored member
      sponsor - sponsor
      Returns:
      Sponsorship object
      Throws:
      SponsorshipDoesNotExistException - if there is no sponsorship relation between the given member and user
    • getSponsoredMembers

      List<Member> getSponsoredMembers(PerunSession sess, Vo vo, User sponsor)
      Gets members sponsored by the given user.
      Parameters:
      sess - perun session
      vo - virtual organization
      sponsor - sponsoring user
      Returns:
      list of members sponsored by the given user
      Throws:
      InternalErrorException
    • getSponsoredMembers

      List<Member> getSponsoredMembers(PerunSession sess, User sponsor)
      Gets members sponsored by the given user in all vos.
      Parameters:
      sess - perun session
      sponsor - sponsoring user
      Returns:
      list of members sponsored by the given user
    • getSponsoredMembers

      List<Member> getSponsoredMembers(PerunSession sess, Vo vo)
      Gets list of sponsored members of a VO.
      Parameters:
      sess - session
      vo - virtual organization from which are the sponsored members chosen
      Returns:
      list of members from given vo who are sponsored
      Throws:
      InternalErrorException - if given parameters are invalid
    • deleteSponsorLinks

      void deleteSponsorLinks(PerunSession sess, Member member)
      Deletes all links to sponsors, even those marked as inactive.
      Parameters:
      sess - perun session
      member - member which is sponsored
      Throws:
      InternalErrorException
    • getUnifiedMemberGroupStatus

      MemberGroupStatus getUnifiedMemberGroupStatus(PerunSession sess, Member member, Resource resource)
      Returns unified result of MemberGroupStatus for specified member and resource. If member is VALID in at least one group assigned to the resource, result is VALID. If member is not VALID in any of groups assigned to the resource, result is EXPIRED. If member is not assigned to the resource at all, result is NULL. MemberGroupStatus is never related to the members status in a VO as a whole!
      Parameters:
      sess - PerunSession
      member - Member to get unified MemberGroupStatus
      resource - Resource to get unified MemberGroupStatus
      Returns:
      MemberGroupStatus for member unified through all his groups assigned to the resource.
    • getUnifiedMemberGroupStatus

      MemberGroupStatus getUnifiedMemberGroupStatus(PerunSession sess, User user, Facility facility)
      Returns unified result of MemberGroupStatus for specified user and facility. If user is VALID in at least one group assigned to at least one resource on facility, result is VALID. If user is not VALID in any of groups assigned to any of resources, result is EXPIRED. If user is not assigned to the facility at all, result is NULL. MemberGroupStatus is never related to the members status in any VO!
      Parameters:
      sess - PerunSession
      user - User to get unified MemberGroupStatus
      facility - Facility to get unified MemberGroupStatus
      Returns:
      MemberGroupStatus for user unified throught all his groups assigned to any of resources of facility.
    • findMembers

      List<Member> findMembers(PerunSession sess, Vo vo, String searchString, boolean onlySponsored)
      Return list of members by specific string. Looking for searchString in user name, member and user id, user uuid, member, users and userExtSource attributes specified by perun.properties. All searches are case insensitive. If parameter onlySponsored is true, it will return only sponsored members by searchString. If vo is null, looking for any members in whole Perun. If vo is not null, looking only in specific VO.
      Parameters:
      sess -
      vo - for which searching will be filtered, if null there is no filter for vo
      searchString - it will be looking for this search string in the specific parameters in DB
      onlySponsored - it will return only sponsored members in vo
      Returns:
      all members from specific VO by specific string
    • getMembersPage

      Paginated<Member> getMembersPage(PerunSession sess, Vo vo, MembersPageQuery query)
      Get page of members from the given vo
      Parameters:
      sess - session
      vo - vo
      query - query with page information
      Returns:
      page of requested rich members
    • updateSponsorshipValidity

      void updateSponsorshipValidity(PerunSession sess, Member sponsoredMember, User sponsor, LocalDate newValidity) throws SponsorshipDoesNotExistException
      Update the sponsorship of given member for given sponsor.
      Parameters:
      sess - session
      sponsoredMember - sponsored member
      sponsor - sponsor
      newValidity - new validity, can be set to null never expire
      Throws:
      SponsorshipDoesNotExistException - if the given user is not sponsor of the given member
    • getSponsorshipsExpiringInRange

      List<Sponsorship> getSponsorshipsExpiringInRange(PerunSession sess, LocalDate from, LocalDate to)
      Returns sponsorship, which have validityTo in range [from, to). (from is inclusive, to is exclusive).
      Parameters:
      sess - session
      from - lower validityTo bound (inclusive), use LocalDate.MIN if you don't want to specify the lower bound
      to - upper validityTo bound (exclusive), use LocalDate.MAX, if you don't want to specify the upper bound
      Returns:
      list of sponsorships which have validityTo set in the given range
    • moveMembersApplications

      void moveMembersApplications(PerunSession sess, Member sourceMember, Member targetMember)
      Move all applications from one member to another member.
      Parameters:
      sess -
      sourceMember - for which move applications from
      targetMember - for which move applications to
    • setLoginNamespacesRulesConfigLoader

      void setLoginNamespacesRulesConfigLoader(LoginNamespacesRulesConfigLoader loginNamespacesRulesConfigLoader)
      Set Login-namespaces rules config loader property
      Parameters:
      loginNamespacesRulesConfigLoader - to set
    • getAllNamespacesRules

      List<NamespaceRules> getAllNamespacesRules()
      Return all loaded namespaces rules.
      Returns:
      all namespaces rules
    • getNamespaceRules

      NamespaceRules getNamespaceRules(String namespace) throws NamespaceRulesNotExistsException
      Get NamespaceRules for the namespace from the LoginNamespacesRulesConfigContainer
      Parameters:
      namespace - for which will be the rules fetched
      Returns:
      NamespaceRules for the namespace
      Throws:
      NamespaceRulesNotExistsException - of there are no rules for the namespace
    • rejectAllMemberOpenApplications

      void rejectAllMemberOpenApplications(PerunSession sess, Member member)
      Reject all member applications which are not Approved or already rejected Reserved login/passwords are also deleted. User is not notified about the rejection.
      Parameters:
      sess - perunSession
      member - which applications will be removed