Package cz.metacentrum.perun.core.bl
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 Summary
Modifier and TypeMethodDescriptionvoid
addMemberVo
(PerunSession sess, Vo vo, Vo memberVo) Adds new relationship between vo and a member vo.void
checkVoExists
(PerunSession sess, Vo vo) 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.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.createVo
(PerunSession perunSession, Vo vo) Create new VO.void
deleteVo
(PerunSession perunSession, Vo vo) Delete VO.void
deleteVo
(PerunSession perunSession, Vo vo, boolean forceDelete) Delete VO.findCandidates
(PerunSession sess, Group group, String searchString) Finds users, who can join the group in Vo.findCandidates
(PerunSession perunSession, Vo vo, String searchString) Finds users, who can join the Vo.findCandidates
(PerunSession perunSession, Vo vo, String searchString, int maxNumOfResults) Finds users, who can join the Vo.getAdminGroups
(PerunSession perunSession, Vo vo) Deprecated.getAdminGroups
(PerunSession perunSession, Vo vo, String role) Get list of group administrators of the given VO.getAdmins
(PerunSession perunSession, Vo vo) Deprecated.getAdmins
(PerunSession perunSession, Vo vo, String role, boolean onlyDirectAdmins) Get list of user administrators of specific vo for specific role.getBanById
(PerunSession sess, int banId) Get ban by its id.getBanForMember
(PerunSession sess, int memberId) Get ban for given member, if it exists.getBansForUser
(PerunSession sess, int userId) Gets all bans for given usergetBansForVo
(PerunSession sess, int voId) Get list of all bans for vo with given id.getCompleteCandidates
(PerunSession sess, Vo vo, Group group, List<String> attrNames, String searchString, List<ExtSource> extSources) Finds MemberCandidates who can join the Group.getCompleteCandidates
(PerunSession sess, Vo vo, List<String> attrNames, String searchString) Finds MemberCandidates who can join the Vo.getDirectAdmins
(PerunSession perunSession, Vo vo) Deprecated.getDirectRichAdmins
(PerunSession perunSession, Vo vo) Deprecated.getDirectRichAdminsWithSpecificAttributes
(PerunSession perunSession, Vo vo, List<String> specificAttributes) Deprecated.getEnrichedBansForUser
(PerunSession sess, int userId, List<String> attrNames) Get all Enriched Bans for given UsergetEnrichedBansForVo
(PerunSession sess, Vo vo, List<String> attrNames) Get all Enriched Bans for given VO and attribute namesgetEnrichedVoById
(PerunSession perunSession, int id) Finds existing vo by and id and returns corresponding EnrichedVogetEnrichedVos
(PerunSession perunSession) Get list of all EnrichedVosgetMemberVos
(PerunSession sess, int voId) Gets all member organizations of the given vo.getParentVos
(PerunSession sess, int memberVoId) Gets all organizations where given vo is direct member.getRichAdmins
(PerunSession perunSession, Vo vo) Deprecated.getRichAdmins
(PerunSession perunSession, Vo vo, String role, List<String> specificAttributes, boolean allUserAttributes, boolean onlyDirectAdmins) Get list of richUser administrators of specific vo for specific role.getRichAdminsWithAttributes
(PerunSession perunSession, Vo vo) Deprecated.getRichAdminsWithSpecificAttributes
(PerunSession perunSession, Vo vo, List<String> specificAttributes) Deprecated.getVoById
(PerunSession perunSession, int id) Finds existing VO by id.getVoByShortName
(PerunSession perunSession, String shortName) Find existing VO by short name (short name is unique).getVoMembersCountsByStatus
(PerunSession sess, Vo vo) Returns number of vo members by their status.getVos
(PerunSession perunSession) Get list of all Vos.getVosByIds
(PerunSession perunSession, List<Integer> ids) Finds existing VOs by ids.getVosByPerunBean
(PerunSession sess, Facility facility) Returns list of vos connected with a facilitygetVosByPerunBean
(PerunSession sess, Group group) Returns list of vos connected with a groupgetVosByPerunBean
(PerunSession sess, Host host) Returns list of vos connected with a hostgetVosByPerunBean
(PerunSession sess, Member member) Returns list of vos connected with a membergetVosByPerunBean
(PerunSession sess, Resource resource) Returns list of vos connected with a resourcegetVosByPerunBean
(PerunSession sess, User user) Returns list of vos connected with a userint
getVosCount
(PerunSession perunSession) Get count of all vos.void
handleGroupLostVoRole
(PerunSession sess, Group group, Vo vo, String role) Handles a group that lost a role.void
handleUserLostVoRole
(PerunSession sess, User user, Vo vo, String role) Handles a user that lost a role.boolean
isMemberBanned
(PerunSession sess, int memberId) Information if there is a ban for member with given id.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.void
removeBan
(PerunSession sess, int banId) Removes ban with given id.void
removeBanForMember
(PerunSession sess, int memberId) Removes ban for member with given id.void
removeMemberVo
(PerunSession sess, Vo vo, Vo memberVo) Removes member vo from given vo.setBan
(PerunSession sess, BanOnVo banOnVo) Set given ban.updateBan
(PerunSession sess, BanOnVo banOnVo) Update ban information.updateVo
(PerunSession perunSession, Vo vo) Updates VO.boolean
usesEmbeddedGroupRegistrations
(PerunSession sess, Vo vo) Returns true, if the given vo uses EMBEDDED_GROUP_APPLICATION item in its form.
-
Method Details
-
getVos
Get list of all Vos.- Parameters:
perunSession
-- Returns:
- List of VOs or empty ArrayList
- Throws:
InternalErrorException
-
getEnrichedVos
Get list of all EnrichedVos- Parameters:
perunSession
-- Returns:
- List of EnrichedVos or empty list
-
deleteVo
Delete VO.- Parameters:
perunSession
-vo
-- Throws:
InternalErrorException
-
deleteVo
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
-
createVo
Create new VO.- Parameters:
perunSession
-vo
- vo object with prefilled voShortName and voName- Returns:
- newly created VO
- Throws:
VoExistsException
InternalErrorException
-
updateVo
Updates VO.- Parameters:
perunSession
-vo
-- Returns:
- returns updated VO
- Throws:
InternalErrorException
-
getVoByShortName
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
-
getVoById
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
-
getEnrichedVoById
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
-
getVosByIds
Finds existing VOs by ids.- Parameters:
perunSession
-ids
-- Returns:
- VOs with requested ids
- 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
Finds users, who can join the Vo.- Parameters:
perunSession
-vo
- vo to be usedsearchString
- 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
Finds users, who can join the group in Vo.- Parameters:
sess
-group
- group to be usedsearchString
- 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
-
getCompleteCandidates
List<MemberCandidate> getCompleteCandidates(PerunSession sess, Vo vo, List<String> attrNames, String searchString) Finds MemberCandidates who can join the Vo.- Parameters:
sess
- sessionvo
- vo to be usedattrNames
- name of attributes to be searchedsearchString
- 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
- sessionvo
- 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 extSourcesgroup
- group to be usedattrNames
- name of attributes to be searchedsearchString
- 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
-
getAdmins
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 roleonlyDirectAdmins
- 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
-
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 richUserallUserAttributes
- 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
-
getAdminGroups
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
-
getAdmins
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
-
getDirectAdmins
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
-
getAdminGroups
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
-
getRichAdmins
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
-
getDirectRichAdmins
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
-
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
-
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
-
getVosByPerunBean
Returns list of vos connected with a group- Parameters:
sess
-group
-- Returns:
- list of vos connected with group
- Throws:
InternalErrorException
VoNotExistsException
-
getVosByPerunBean
Returns list of vos connected with a member- Parameters:
sess
-member
-- Returns:
- list of vos connected with member
- Throws:
InternalErrorException
-
getVosByPerunBean
Returns list of vos connected with a resource- Parameters:
sess
-resource
-- Returns:
- list of vos connected with resource
- Throws:
InternalErrorException
VoNotExistsException
-
getVosByPerunBean
Returns list of vos connected with a user- Parameters:
sess
-user
-- Returns:
- list of vos connected with user
- Throws:
InternalErrorException
-
getVosByPerunBean
Returns list of vos connected with a host- Parameters:
sess
-host
-- Returns:
- list of vos connected with host
- Throws:
InternalErrorException
-
getVosByPerunBean
Returns list of vos connected with a facility- Parameters:
sess
-facility
-- Returns:
- list of vos connected with facility
- Throws:
InternalErrorException
-
checkVoExists
- Throws:
VoNotExistsException
-
getVosCount
Get count of all vos.- Parameters:
perunSession
-- Returns:
- count of all vos
- Throws:
InternalErrorException
-
getVoMembersCountsByStatus
Returns number of vo members by their status.- Parameters:
sess
- perun sessionvo
- vo of members- Returns:
- map of status in vo to number of vo members with the status
-
isUserInRoleForVo
Check whether a user is in a role for a given VO, possibly checking also user's groups.- Parameters:
session
- sessionuser
- userrole
- rolevo
- virtual organizationcheckGroups
- 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
-
handleUserLostVoRole
Handles a user that lost a role.- Parameters:
sess
- perun sessionuser
- uservo
- virtual organizationrole
- role of user in VO- Throws:
InternalErrorException
-
handleGroupLostVoRole
Handles a group that lost a role.- Parameters:
sess
- perun sessiongroup
- groupvo
- virtual organizationrole
- role of group in VO- Throws:
InternalErrorException
-
setBan
BanOnVo setBan(PerunSession sess, BanOnVo banOnVo) throws MemberNotExistsException, BanAlreadyExistsException Set given ban.- Parameters:
sess
- sessionbanOnVo
- ban information, memberId, voId, validity and description are needed- Returns:
- created ban object
- Throws:
MemberNotExistsException
BanAlreadyExistsException
-
getBanById
Get ban by its id.- Parameters:
sess
- sessionbanId
- ban id- Returns:
- ban object
- Throws:
BanNotExistsException
- if ban with given id is not found
-
getBanForMember
Get ban for given member, if it exists.- Parameters:
sess
- sessionmemberId
- member id- Returns:
- ban object, or null if there is no ban for given member
-
getBansForVo
Get list of all bans for vo with given id.- Parameters:
sess
- sessionvoId
- vo id- Returns:
- list of bans for given vo
-
updateBan
Update ban information. Only description and validity are updated.- Parameters:
sess
- sessionbanOnVo
- updated ban- Returns:
- updated ban object
-
removeBan
Removes ban with given id.- Parameters:
sess
- sessionbanId
- ban id- Throws:
BanNotExistsException
- if there is no ban with given id
-
removeBanForMember
Removes ban for member with given id.- Parameters:
sess
- sessionmemberId
- member id- Throws:
BanNotExistsException
- if there is no ban for member with given id
-
isMemberBanned
Information if there is a ban for member with given id.- Parameters:
sess
- sessionmemberId
- member id- Returns:
- true, if member with given id is banned, false otherwise
-
convertSponsoredUsers
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
- sessionvo
- vo where members will be converted
-
convertSponsoredUsersWithNewSponsor
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
- sessionvo
- vo where members will be convertednewSponsor
- user, who will be set as a sponsor to the sponsored members
-
usesEmbeddedGroupRegistrations
Returns true, if the given vo uses EMBEDDED_GROUP_APPLICATION item in its form.- Parameters:
sess
- sessionvo
- vo- Returns:
- true, if the given vo uses EMBEDDED_GROUP_APPLICATION item in its form, false otherwise.
-
addMemberVo
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
- sessionvo
- vomemberVo
- new member of the vo- Throws:
RelationExistsException
- if member vo is already member of the vo
-
removeMemberVo
Removes member vo from given vo. Updates memberOrganizations list attribute for those members of parent vo who came from the member vo.- Parameters:
sess
- sessionvo
- vomemberVo
- vo to be removed- Throws:
RelationNotExistsException
- if member vo is not a member of the vo
-
getMemberVos
Gets all member organizations of the given vo.- Parameters:
sess
- sessionvoId
- vo id- Returns:
- list of member vos
-
getParentVos
Gets all organizations where given vo is direct member.- Parameters:
sess
- sessionmemberVoId
- member vo id- Returns:
- list of direct parent vos
-
getBansForUser
Gets all bans for given user- Parameters:
sess
- sessionuserId
- id of user- Returns:
- list of bans for given user
-
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
- sesionvo
- VOattrNames
- List of attributes, returns all attributes if null or empty- Returns:
- list of enriched bans
- Throws:
VoNotExistsException
- if vo not existsAttributeNotExistsException
-
getEnrichedBansForUser
List<EnrichedBanOnVo> getEnrichedBansForUser(PerunSession sess, int userId, List<String> attrNames) throws AttributeNotExistsException Get all Enriched Bans for given User- Parameters:
sess
- sesionuserId
- User IDattrNames
- List of attributes, returns all attributes if null or empty- Returns:
- List of Enriched Bans
- Throws:
UserNotExistsException
- if user not existsAttributeNotExistsException
-