Interface MembersManagerImplApi
- All Known Implementing Classes:
MembersManagerImpl
public interface MembersManagerImplApi
MembersManager can find members.
- Author:
- Michal Prochazka, Slavek Licehammer, Zora Sebestianova
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSponsor
(PerunSession session, Member sponsoredMember, User sponsor) Adds another sponsoring user for a sponsored member.void
addSponsor
(PerunSession session, Member sponsoredMember, User sponsor, LocalDate validityTo) Adds another sponsoring user for a sponsored member.void
checkMemberExists
(PerunSession perunSession, Member member) Check if member exists in underlaying data source.createMember
(PerunSession perunSession, Vo vo, User user) Creates member entry in the database.createSponsoredMember
(PerunSession session, Vo vo, User sponsored, User sponsor, LocalDate validityTo) Creates a new member in given Vo with flag "sponsored", and linked to its sponsoring user.void
deleteAllSponsors
(PerunSession session, Member sponsoredMember) Delete all existing sponsorships for defined member.void
deleteMember
(PerunSession perunSession, Member member) Deletes only member data appropriated by member id.void
deleteSponsorLinks
(PerunSession sess, Member member) Deletes all links to sponsors, even those marked as inactive.findMembers
(PerunSession sess, Vo vo, String searchString, boolean onlySponsored) Return list of members by specific string.getAllMembers
(PerunSession sess) Get all members from all vos.Return all loaded namespaces rules.getAvailableSponsorsForMember
(PerunSession sess, Member member) Returns all available sponsors for given member.getMemberById
(PerunSession perunSession, int id) Returns member by his id.getMemberByUserExtSource
(PerunSession perunSession, Vo vo, UserExtSource userExtSource) Find member of this Vo by his login in external sourcegetMemberByUserId
(PerunSession perunSession, Vo vo, int userId) Returns member by his user id and vo.getMembersByIds
(PerunSession perunSession, List<Integer> ids) Gets members by their ids.getMembersByUser
(PerunSession sess, User user) Return all VO Members of the User.getMembersByUsers
(PerunSession sess, List<User> users, Vo vo) Convert list of users into the list of members.getMembersByUsersIds
(PerunSession sess, List<Integer> usersIds, Vo vo) Convert list of users' ids into the list of members.getMembersByUserWithStatus
(PerunSession sess, User user, Status status) Return all VO Members of the User, which have specified Status in their VO.int
getMembersCount
(PerunSession sess, Vo vo) Returns all members from the VO (with every status).int
getMembersCount
(PerunSession sess, Vo vo, Status status) Returns number of Vo members with defined status.getMembersPage
(PerunSession sess, Vo vo, MembersPageQuery query) Get page of members from the given vogetMembersPage
(PerunSession sess, Vo vo, MembersPageQuery query, String policy) Get page of members from the given voint
getMemberVoId
(PerunSession perunSession, Member member) Get member's VO idgetNamespaceRules
(String namespace) Get NamespaceRules for the namespace from the LoginNamespacesRulesConfigContainergetSponsoredMembers
(PerunSession sess, User sponsor) Gets members sponsored by the given user in all vos.getSponsoredMembers
(PerunSession sess, Vo vo) Gets list of sponsored members of a VO.getSponsoredMembers
(PerunSession sess, Vo vo, User sponsor) Gets members sponsored by the given user.getSponsoredRichMembers
(PerunSession sess, Vo vo) Get list of rich members that are sponsored in the VO.getSponsorship
(PerunSession sess, Member sponsoredMember, User sponsor) For the given member and user returns their sponsorship relation object.getSponsorshipsExpiringInRange
(PerunSession sess, LocalDate from, LocalDate to) Returns sponsorship, which have validityTo in range [from, to).getUnifiedMemberGroupStatus
(PerunSession sess, Member member, Resource resource) Returns unified result of MemberGroupStatus for specified member and resource.getUnifiedMemberGroupStatus
(PerunSession sess, User user, Facility facility) Returns unified result of MemberGroupStatus for specified user and facility.boolean
memberExists
(PerunSession perunSession, Member member) Check if member exists in underlaying data source.void
moveMembersApplications
(PerunSession sess, Member sourceMember, Member targetMember) Move all applications from one member to another member.void
rejectAllMemberOpenApplications
(PerunSession sess, Member member) Reject all member applications which are not Approved or already rejected Reserved login/passwords are also deleted.void
removeSponsor
(PerunSession sess, Member sponsoredMember, User sponsor) Removes a sponsoring user.void
setLoginNamespacesRulesConfigLoader
(LoginNamespacesRulesConfigLoader loginNamespacesRulesConfigLoader) Set Login-namespaces rules config loader propertysetSponsorshipForMember
(PerunSession session, Member sponsoredMember, User sponsor, LocalDate validityTo) Set member to be sponsored by sponsor.void
setStatus
(PerunSession sess, Member member, Status status) Set status of the member to specified status.boolean
someAvailableSponsorExistsForMember
(PerunSession sess, Member member) Checks if some vo sponsor who does not already sponsor given member exists.storePasswordResetRequest
(PerunSession sess, User user, String namespace, String mail, LocalDateTime validityTo) Store information about password reset request.unsetSponsorshipForMember
(PerunSession session, Member sponsoredMember) Unset member to not be sponsored by anybody from now.void
updateSponsorshipValidity
(PerunSession sess, Member sponsoredMember, User sponsor, LocalDate newValidity) Update the sponsorship of given member for given sponsor.
-
Method Details
-
addSponsor
void addSponsor(PerunSession session, Member sponsoredMember, User sponsor) throws AlreadySponsorException Adds another sponsoring user for a sponsored member.- Parameters:
session
- perun sessionsponsoredMember
- member which is sponsoredsponsor
- sponsoring user- Throws:
InternalErrorException
AlreadySponsorException
- if member was already sponsored before this call
-
addSponsor
void addSponsor(PerunSession session, Member sponsoredMember, User sponsor, LocalDate validityTo) throws AlreadySponsorException Adds another sponsoring user for a sponsored member.- Parameters:
session
- perun sessionsponsoredMember
- member which is sponsoredsponsor
- sponsoring uservalidityTo
- time, when the sponsorship will expire- Throws:
InternalErrorException
AlreadySponsorException
- if member was already sponsored before this call
-
checkMemberExists
Check if member exists in underlaying data source.- Parameters:
perunSession
-member
-- Throws:
InternalErrorException
MemberNotExistsException
-
createMember
Creates member entry in the database. Created member is in invalid state.- Parameters:
perunSession
-vo
- Vouser
- User- Returns:
- created member with id filled
- Throws:
InternalErrorException
AlreadyMemberException
-
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
- PerunSessionvo
- vo where newly created member will be sponsoredsponsored
- user for which the new membership will be created (and also sponsored)sponsor
- sponsor of new membershipvalidityTo
- time, when the sponsorship will expire- Returns:
- sponsored member
- Throws:
AlreadyMemberException
- if user has already a membership in the voAlreadySponsorException
- if member is already sponsored by the sponsor
-
deleteAllSponsors
Delete all existing sponsorships for defined member. This method will delete them, not just marked.- Parameters:
session
- perun sessionsponsoredMember
- member which is sponsored- Throws:
InternalErrorException
-
deleteMember
Deletes only member data appropriated by member id.- Parameters:
perunSession
-member
-- Throws:
InternalErrorException
MemberAlreadyRemovedException
- if there are 0 rows affected by removing from DB
-
deleteSponsorLinks
Deletes all links to sponsors, even those marked as inactive.- Parameters:
sess
- perun sessionmember
- member which is sponsored- Throws:
InternalErrorException
-
findMembers
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 vosearchString
- it will be looking for this search string in the specific parameters in DBonlySponsored
- it will return only sponsored members in vo- Returns:
- all members from specific VO by specific string
-
getAllMembers
Get all members from all vos.- Parameters:
sess
- session- Returns:
- list of all members from all Vos.
-
getAllNamespacesRules
List<NamespaceRules> getAllNamespacesRules()Return all loaded namespaces rules.- Returns:
- all namespaces rules
-
getMemberById
Returns member by his id.- Parameters:
perunSession
-id
-- Returns:
- member
- Throws:
InternalErrorException
MemberNotExistsException
-
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
-
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
-
getMemberVoId
Get member's VO id- Parameters:
perunSession
-member
-- Returns:
- VO id
- Throws:
InternalErrorException
-
getMembersByIds
Gets members by their ids. Silently skips non-existing members.- Parameters:
perunSession
-ids
-- Returns:
- list of members with specified ids
- Throws:
InternalErrorException
-
getMembersByUser
Return all VO Members of the User.- Parameters:
sess
-user
-- Returns:
- List of Members
- Throws:
InternalErrorException
-
getMembersByUserWithStatus
Return all VO Members of the User, which have specified Status in their VO.- Parameters:
sess
-user
-status
-- Returns:
- List of Members
- Throws:
InternalErrorException
-
getMembersByUsers
Convert list of users into the list of members.- Parameters:
sess
-users
-vo
-- Returns:
- list of members
- Throws:
InternalErrorException
-
getMembersByUsersIds
Convert list of users' ids into the list of members.- Parameters:
sess
-usersIds
-vo
-- Returns:
- list of members
- Throws:
InternalErrorException
-
getMembersCount
Returns all members from the VO (with every status).- Parameters:
sess
-vo
-- Returns:
- number of members
- Throws:
InternalErrorException
-
getMembersCount
Returns number of Vo members with defined status.- Parameters:
sess
-vo
-status
-- Returns:
- number of members
- Throws:
InternalErrorException
-
getMembersPage
Paginated<Member> getMembersPage(PerunSession sess, Vo vo, MembersPageQuery query, String policy) throws PolicyNotExistsException Get page of members from the given vo- Parameters:
sess
- sessionvo
- voquery
- query with page informationpolicy
- policy to replace the default one (`filter_getMembersPage-policy`)- Returns:
- page of requested rich members
- Throws:
PolicyNotExistsException
-
getMembersPage
Paginated<Member> getMembersPage(PerunSession sess, Vo vo, MembersPageQuery query) throws PolicyNotExistsException Get page of members from the given vo- Parameters:
sess
- sessionvo
- voquery
- query with page information- Returns:
- page of requested rich members
- Throws:
PolicyNotExistsException
-
getNamespaceRules
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
-
getSponsoredMembers
Gets members sponsored by the given user.- Parameters:
sess
- perun sessionvo
- virtual organizationsponsor
- sponsoring user- Returns:
- list of members sponsored by the given user
- Throws:
InternalErrorException
-
getSponsoredMembers
Gets members sponsored by the given user in all vos.- Parameters:
sess
- perun sessionsponsor
- sponsoring user- Returns:
- list of members sponsored by the given user
-
getSponsoredMembers
Gets list of sponsored members of a VO.- Parameters:
sess
- sessionvo
- 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
-
getSponsoredRichMembers
Get list of rich members that are sponsored in the VO.- Parameters:
sess
-vo
-- Returns:
- list of rich members which are sponsored in the given VO
-
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
- sessionsponsoredMember
- sponsored membersponsor
- sponsor- Returns:
- Sponsorship object
- Throws:
SponsorshipDoesNotExistException
- if there is no sponsorship relation between the given member and user
-
getSponsorshipsExpiringInRange
Returns sponsorship, which have validityTo in range [from, to). (from is inclusive, to is exclusive).- Parameters:
sess
- sessionfrom
- lower validityTo bound (inclusive), use LocalDate.MIN if you don't want to specify the lower boundto
- 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
-
getUnifiedMemberGroupStatus
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
- PerunSessionmember
- Member to get unified MemberGroupStatusresource
- Resource to get unified MemberGroupStatus- Returns:
- MemberGroupStatus for member unified through all his groups assigned to the resource.
-
getUnifiedMemberGroupStatus
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
- PerunSessionuser
- User to get unified MemberGroupStatusfacility
- Facility to get unified MemberGroupStatus- Returns:
- MemberGroupStatus for user unified throught all his groups assigned to any of resources of facility.
-
memberExists
Check if member exists in underlaying data source.- Parameters:
perunSession
-member
-- Returns:
- true if member exists in underlaying data source, false otherwise
- Throws:
InternalErrorException
-
moveMembersApplications
Move all applications from one member to another member.- Parameters:
sess
-sourceMember
- for which move applications fromtargetMember
- for which move applications to
-
rejectAllMemberOpenApplications
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
- perunSessionmember
- which applications will be removed
-
removeSponsor
Removes a sponsoring user. In fact marks the link as inactive.- Parameters:
sess
- perun sessionsponsoredMember
- member which is sponsoredsponsor
- sponsoring user- Throws:
InternalErrorException
-
setLoginNamespacesRulesConfigLoader
void setLoginNamespacesRulesConfigLoader(LoginNamespacesRulesConfigLoader loginNamespacesRulesConfigLoader) Set Login-namespaces rules config loader property- Parameters:
loginNamespacesRulesConfigLoader
- to set
-
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 nowsponsor
- user which will be a sponsor for member- Returns:
- sponsored member
- Throws:
InternalErrorException
AlreadySponsorException
- if member was already sponsored before this call
-
setStatus
Set status of the member to specified status.- Parameters:
sess
-member
-status
- new status- Throws:
InternalErrorException
-
storePasswordResetRequest
UUID storePasswordResetRequest(PerunSession sess, User user, String namespace, String mail, LocalDateTime validityTo) Store information about password reset request.- Parameters:
sess
- PerunSessionuser
- User to reset password fornamespace
- namespace to reset password inmail
- mail address used to send request tovalidityTo
- time till request is valid- Returns:
- request's UUID to be used for validation
- Throws:
InternalErrorException
-
unsetSponsorshipForMember
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
-
updateSponsorshipValidity
void updateSponsorshipValidity(PerunSession sess, Member sponsoredMember, User sponsor, LocalDate newValidity) throws SponsorshipDoesNotExistException Update the sponsorship of given member for given sponsor.- Parameters:
sess
- sessionsponsoredMember
- sponsored membersponsor
- sponsornewValidity
- new validity, can be set to null never expire- Throws:
SponsorshipDoesNotExistException
- if the given user is not sponsor of the given member
-
someAvailableSponsorExistsForMember
Checks if some vo sponsor who does not already sponsor given member exists.- Parameters:
sess
- perun sessionmember
- member- Returns:
- true if available sponsor exists, false otherwise
-
getAvailableSponsorsForMember
Returns all available sponsors for given member.- Parameters:
sess
- perun sessionmember
- member- Returns:
- list of available sponsors
-