Package cz.metacentrum.perun.core.api
Interface FacilitiesManager
- All Known Implementing Classes:
FacilitiesManagerEntry
public interface FacilitiesManager
Facility manager can create a new facility or find an existing facility.
- Author:
- Michal Prochazka, Slavek Licehammer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdmin
(PerunSession sess, Facility facility, Group group) Adds group administrator to the Facility.void
addAdmin
(PerunSession sess, Facility facility, User user) Adds user administrator to the Facility.addHost
(PerunSession perunSession, Host host, Facility facility) Adds host to the Facility.addHosts
(PerunSession sess, Facility facility, List<String> hosts) Create hosts in Perun and add them to the Facility.addHosts
(PerunSession sess, List<Host> hosts, Facility facility) Adds hosts to the Facility.void
addOwner
(PerunSession perunSession, Facility facility, Owner owner) Add owner of the facilityvoid
addOwners
(PerunSession sess, Facility facility, List<Owner> owners) Add owners of the facilityvoid
assignSecurityTeam
(PerunSession sess, Facility facility, SecurityTeam securityTeam) Assign given security team to given facility (means the facility trusts the security team)void
copyAttributes
(PerunSession sess, Facility sourceFacility, Facility destinationFacility) Copy all attributes of the source facility to the destination facility.void
copyManagers
(PerunSession sess, Facility sourceFacility, Facility destinationFacility) Copy all managers(admins) of the source facility to the destination facility.void
copyOwners
(PerunSession sess, Facility sourceFacility, Facility destinationFacility) Copy all owners of the source facility to the destination facility.createFacility
(PerunSession perunSession, Facility facility) Store the facility.void
deleteFacility
(PerunSession perunSession, Facility facility, Boolean force) Delete the facility by id.getAdminGroups
(PerunSession sess, Facility facility) Deprecated.getAdmins
(PerunSession sess, Facility facility) Deprecated.getAdmins
(PerunSession perunSession, Facility facility, boolean onlyDirectAdmins) Deprecated.getAllowedGroups
(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService) Get all Groups which can use this facility (Groups must be assigned to resource which belongs to this facility) specificVo and specificService can choose concrete groups if specificVo, specificService or both are null, they do not specific (all possible results are returned)getAllowedRichGroupsWithAttributes
(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService, List<String> attrNames) Get all RichGroups which can use this facility (Groups must be assigned to Resource which belongs to this facility) specificVo and specificService can choose concrete groups if specificVo, specificService or both are null, they do not specific (all possible results are returned) We also retrieve attributes specified by attrNames for each returned RichGroup.getAllowedUsers
(PerunSession perunSession, Facility facility) Return all users who can use this facilitygetAllowedUsers
(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService) Return all users who can use this facility specificVo and specificService can choose concrete users if specificVo, specificService or both are null, they do not specific (all possible results are returned)getAllowedVos
(PerunSession perunSession, Facility facility) Return all VO which can use this facility.getAssignedFacilities
(PerunSession sess, Group group) Get facilities which are assigned to Group (via resource).getAssignedFacilities
(PerunSession sess, Member member) Get facilities which have the member access on.getAssignedFacilities
(PerunSession sess, SecurityTeam securityTeam) Get facilities where security team is assigned.getAssignedFacilities
(PerunSession sess, Service service) Get facilities where the service is defined.getAssignedFacilities
(PerunSession sess, User user) Get facilities which have the user access on.getAssignedResources
(PerunSession perunSession, Facility facility) Returns all resources assigned to the facility.getAssignedResourcesByAssignedService
(PerunSession perunSession, Facility facility, Service service) Returns resources with specific service assigned to the facility.getAssignedRichResources
(PerunSession perunSession, Facility facility) Returns all rich resources assigned to the facility with VO property filledgetAssignedRichResources
(PerunSession perunSession, Facility facility, Service service) Returns all rich resources assigned to the facility and service with VO property filledgetAssignedSecurityTeams
(PerunSession sess, Facility facility) return assigned security teams for specific facilitygetAssignedUsers
(PerunSession sess, Facility facility) Returns list of Users, assigned with chosen Facility.getAssignedUsers
(PerunSession sess, Facility facility, Service service) Returns list of Users assigned with chosen Facility containing resources where service is assigned.getBan
(PerunSession sess, int userId, int faclityId) Get ban by userId and facilityId.getBanById
(PerunSession sess, int banId) Get Ban for user on facility by it's idgetBansForFacility
(PerunSession sess, int facilityId) Get all bans for users on the facilitygetBansForUser
(PerunSession sess, int userId) Get all bans for user on any facility.getDirectAdmins
(PerunSession perunSession, Facility facility) Deprecated.getDirectRichAdminsWithSpecificAttributes
(PerunSession perunSession, Facility facility, List<String> specificAttributes) Deprecated.getEnrichedBansForFacility
(PerunSession sess, int facilityId, List<String> attrNames) Get all enriched bans for users on the facility.getEnrichedBansForUser
(PerunSession sess, int userId, List<String> attrNames) Get all enriched bans on facility for user.getEnrichedFacilities
(PerunSession perunSession) Gets all enriched facilities user has access rights to.getEnrichedHosts
(PerunSession sess, Facility facility, List<String> attrNames) Return all EnrichedHosts of given facility.getFacilities
(PerunSession perunSession) List facilities by ACCESS RIGHTS: If User is: - PERUNADMIN : all facilities - FACILITYADMIN : only facilities where user is facility admingetFacilitiesByAttribute
(PerunSession sess, String attributeName, String attributeValue) Returns all facilities that have set the attribute 'attributeName' with the value 'attributeValue'.getFacilitiesByAttributeWithAttributes
(PerunSession sess, String searchAttributeName, String searchAttributeValue, List<String> attrNames) Searches (partially!) for facilities with the attribute 'searchAttributeName' and its value 'searchAttributeValue'.getFacilitiesByDestination
(PerunSession perunSession, String destination) Searches for the Facilities by theirs destination.getFacilitiesByHostName
(PerunSession sess, String hostname) Return all facilities where exists host with the specific hostnamegetFacilitiesByIds
(PerunSession perunSession, List<Integer> ids) Searches for the Facilities with specified ids.int
getFacilitiesCount
(PerunSession perunSession) Get count of all facilities.getFacilitiesWhereUserIsAdmin
(PerunSession sess, User user) Get all facilities where the user is admin.getFacilityById
(PerunSession perunSession, int id) Searches for the Facility with specified id.getFacilityByName
(PerunSession perunSession, String name) Searches the Facility by its name.getFacilityForHost
(PerunSession sess, Host host) Return facility which has the host.getHostById
(PerunSession sess, int id) Get the host by its ID.getHosts
(PerunSession sess, Facility facility) List hosts of Facility.getHostsByHostname
(PerunSession sess, String hostname) Get all hosts with this hostname (from all facilities).int
getHostsCount
(PerunSession sess, Facility facility) Count hosts of Facility.getOwnerFacilities
(PerunSession perunSession, Owner owner) Returns list of all facilities owned by the owner.getOwners
(PerunSession perunSession, Facility facility) Returns owners of the facility.getRichAdmins
(PerunSession sess, Facility facility) Deprecated.getRichAdmins
(PerunSession perunSession, Facility facility, List<String> specificAttributes, boolean allUserAttributes, boolean onlyDirectAdmins) Deprecated.getRichAdminsWithAttributes
(PerunSession sess, Facility facility) Deprecated.getRichAdminsWithSpecificAttributes
(PerunSession perunSession, Facility facility, List<String> specificAttributes) Deprecated.getRichFacilities
(PerunSession perunSession) Get all possible rich Facilities with all their owners.void
removeAdmin
(PerunSession sess, Facility facility, Group group) Removes a group administrator from the Facility.void
removeAdmin
(PerunSession sess, Facility facility, User user) Removes a user administrator from the Facility.void
removeBan
(PerunSession sess, int banId) Remove existing ban by it's id.void
removeBan
(PerunSession sess, int userId, int facilityId) Remove existing ban by id of user and facility.void
removeHost
(PerunSession perunSession, Host host) Remove hosts from the Facility.void
removeHostByHostname
(PerunSession perunSession, String hostname) Remove host from the Facility based on hostname.void
removeHosts
(PerunSession sess, List<Host> hosts, Facility facility) Remove hosts from the Facility.void
removeOwner
(PerunSession perunSession, Facility facility, Owner owner) Remove owner of the facilityvoid
removeOwners
(PerunSession sess, Facility facility, List<Owner> owners) Remove owners of the facilityvoid
removeSecurityTeam
(PerunSession sess, Facility facility, SecurityTeam securityTeam) Remove (Unassign) given security team from given facilitysetBan
(PerunSession sess, BanOnFacility banOnFacility) Set ban for user on facility.void
setOwners
(PerunSession perunSession, Facility facility, List<Owner> owners) Deprecated.Use addOwner and removeOwner insteadupdateBan
(PerunSession sess, BanOnFacility banOnFacility) Update existing ban (description and validation timestamp)updateFacility
(PerunSession perunSession, Facility facility) Updates facility.
-
Method Details
-
addAdmin
void addAdmin(PerunSession sess, Facility facility, User user) throws FacilityNotExistsException, UserNotExistsException, PrivilegeException, AlreadyAdminException, RoleCannotBeManagedException, RoleCannotBeSetException Adds user administrator to the Facility. -
addAdmin
void addAdmin(PerunSession sess, Facility facility, Group group) throws FacilityNotExistsException, GroupNotExistsException, PrivilegeException, AlreadyAdminException, RoleCannotBeManagedException, RoleCannotBeSetException Adds group administrator to the Facility.- Parameters:
group
- that will become a Facility administrator- Throws:
FacilityNotExistsException
GroupNotExistsException
PrivilegeException
AlreadyAdminException
RoleCannotBeManagedException
RoleCannotBeSetException
-
addHost
Host addHost(PerunSession perunSession, Host host, Facility facility) throws FacilityNotExistsException, PrivilegeException Adds host to the Facility. Adds host only if host and destination with the same name doesn't exist or if privilege requirements are met.- Returns:
- host
- Throws:
FacilityNotExistsException
PrivilegeException
-
addHosts
List<Host> addHosts(PerunSession sess, List<Host> hosts, Facility facility) throws FacilityNotExistsException, PrivilegeException, HostExistsException Adds hosts to the Facility. Adds hosts only if host and destination with the same name doesn't exist or if privilege requirements are met. Note: If you wish to add more hosts, it is recommended to prepare a Listof them so as there can be only one database call. - Parameters:
hosts
- ID of any host doesn't need to be filled. Hosts will be created.- Returns:
- Hosts with ID's set.
- Throws:
FacilityNotExistsException
PrivilegeException
HostExistsException
-
addHosts
List<Host> addHosts(PerunSession sess, Facility facility, List<String> hosts) throws FacilityNotExistsException, PrivilegeException, HostExistsException, WrongPatternException Create hosts in Perun and add them to the Facility. Adds hosts only if host and destination with the same name doesn't exist or if privilege requirements are met. Names of the hosts can be generative. The pattern is string with square brackets, e.g. "local[1-3]domain". Then the content of the brackets is distributed, so the list is [local1domain, local2domain, local3domain]. Multibrackets are aslo allowed. For example "a[00-01]b[90-91]c" generates [a00b90c, a00b91c, a01b90c, a01b91c].- Parameters:
hosts
- list of strings with names of hosts, the name can by generative- Returns:
- Hosts with ID's set.
- Throws:
WrongPatternException
- when syntax of any of the hostnames is wrongFacilityNotExistsException
PrivilegeException
HostExistsException
-
addOwner
void addOwner(PerunSession perunSession, Facility facility, Owner owner) throws PrivilegeException, OwnerNotExistsException, FacilityNotExistsException, OwnerAlreadyAssignedException Add owner of the facility -
addOwners
void addOwners(PerunSession sess, Facility facility, List<Owner> owners) throws PrivilegeException, OwnerNotExistsException, FacilityNotExistsException, OwnerAlreadyAssignedException Add owners of the facility- Parameters:
sess
- perun sessionfacility
- facilityowners
- list of owners to be added- Throws:
PrivilegeException
- when the principal does not have sufficient rightsOwnerNotExistsException
- when owner does not existFacilityNotExistsException
- when facility does not existOwnerAlreadyAssignedException
- when owner was already assigned to the facility
-
assignSecurityTeam
void assignSecurityTeam(PerunSession sess, Facility facility, SecurityTeam securityTeam) throws PrivilegeException, FacilityNotExistsException, SecurityTeamNotExistsException, SecurityTeamAlreadyAssignedException Assign given security team to given facility (means the facility trusts the security team)- Throws:
PrivilegeException
- can do only PerunAdmin or FacilityAdmin of the facilityFacilityNotExistsException
SecurityTeamNotExistsException
SecurityTeamAlreadyAssignedException
-
copyAttributes
void copyAttributes(PerunSession sess, Facility sourceFacility, Facility destinationFacility) throws PrivilegeException, FacilityNotExistsException, WrongAttributeAssignmentException, WrongAttributeValueException, WrongReferenceAttributeValueException Copy all attributes of the source facility to the destination facility. The attributes, that are in the destination facility and aren't in the source facility, are retained. The common attributes are replaced with attributes from source facility.- Throws:
WrongAttributeAssignmentException
- if there is no facility attributeWrongAttributeValueException
- if the attribute value is illegalWrongReferenceAttributeValueException
- if the attribute value is illegalPrivilegeException
FacilityNotExistsException
-
copyManagers
void copyManagers(PerunSession sess, Facility sourceFacility, Facility destinationFacility) throws PrivilegeException, FacilityNotExistsException Copy all managers(admins) of the source facility to the destination facility. The admins, that are in the destination facility and aren't in the source facility, are retained. The common admins are also retained in destination facility. -
copyOwners
void copyOwners(PerunSession sess, Facility sourceFacility, Facility destinationFacility) throws FacilityNotExistsException, PrivilegeException Copy all owners of the source facility to the destination facility. The owners, that are in the destination facility and aren't in the source facility, are retained. The common owners are replaced with owners from source facility. -
createFacility
Facility createFacility(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityExistsException, ConsentHubExistsException Store the facility. -
deleteFacility
void deleteFacility(PerunSession perunSession, Facility facility, Boolean force) throws RelationExistsException, FacilityNotExistsException, PrivilegeException, FacilityAlreadyRemovedException, HostAlreadyRemovedException, ResourceAlreadyRemovedException, GroupAlreadyRemovedFromResourceException Delete the facility by id.- Throws:
FacilityAlreadyRemovedException
- if 0 rows affected by delete from DBHostAlreadyRemovedException
- if there is at least 1 hosts not affected by deleting from DBResourceAlreadyRemovedException
- if there is at least 1 resource not affected by deleting from DBGroupAlreadyRemovedFromResourceException
- if there is at least 1 group on any resource affected by removing from DBRelationExistsException
FacilityNotExistsException
PrivilegeException
-
getAdminGroups
@Deprecated List<Group> getAdminGroups(PerunSession sess, Facility facility) throws PrivilegeException, FacilityNotExistsException Deprecated.Gets list of all group administrators of the Facility.- Returns:
- list of Group that are admins in the facility.
- Throws:
PrivilegeException
FacilityNotExistsException
-
getAdmins
@Deprecated List<User> getAdmins(PerunSession perunSession, Facility facility, boolean onlyDirectAdmins) throws PrivilegeException, FacilityNotExistsException Deprecated.Gets list of all user administrators of the Facility. If some group is administrator of the given group, all VALID members are included in the list.If onlyDirectAdmins is true, return only direct users of the group for supported role.
Supported roles: FacilityAdmin
- Parameters:
onlyDirectAdmins
- if true, get only direct user administrators (if false, get both direct and indirect)- Returns:
- list of all user administrators of the given facility for supported role
- Throws:
PrivilegeException
FacilityNotExistsException
-
getAdmins
@Deprecated List<User> getAdmins(PerunSession sess, Facility facility) throws PrivilegeException, FacilityNotExistsException Deprecated.Gets list of all user administrators of the Facility. If some group is administrator of the given group, all members are included in the list.- Returns:
- list of Users who are admins in the facility.
- Throws:
PrivilegeException
FacilityNotExistsException
-
getAllowedGroups
List<Group> getAllowedGroups(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException, VoNotExistsException Get all Groups which can use this facility (Groups must be assigned to resource which belongs to this facility) specificVo and specificService can choose concrete groups if specificVo, specificService or both are null, they do not specific (all possible results are returned)- Parameters:
facility
- searching for this facilityspecificVo
- specific only those results which are in specific VO (with null, all results)specificService
- specific only those results, which have resource with assigned specific service (if null, all results)- Returns:
- list of allowed groups
- Throws:
FacilityNotExistsException
- if facility not exist, return this exceptionServiceNotExistsException
- if service is not null and not existVoNotExistsException
- if vo is not null and not existPrivilegeException
-
getAllowedRichGroupsWithAttributes
List<RichGroup> getAllowedRichGroupsWithAttributes(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService, List<String> attrNames) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException, VoNotExistsException Get all RichGroups which can use this facility (Groups must be assigned to Resource which belongs to this facility) specificVo and specificService can choose concrete groups if specificVo, specificService or both are null, they do not specific (all possible results are returned) We also retrieve attributes specified by attrNames for each returned RichGroup.- Parameters:
facility
- searching for this facilityspecificVo
- specific only those results which are in specific VO (with null, all results)specificService
- specific only those results, which have resource with assigned specific service (if null, all results)attrNames
- with each returned RichGroup we get also attributes specified by this list- Returns:
- list of allowed groups
- Throws:
FacilityNotExistsException
- if facility not exist, return this exceptionServiceNotExistsException
- if service is not null and not existVoNotExistsException
- if vo is not null and not existPrivilegeException
-
getAllowedUsers
List<User> getAllowedUsers(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Return all users who can use this facility- Returns:
- list of users
- Throws:
PrivilegeException
FacilityNotExistsException
-
getAllowedUsers
List<User> getAllowedUsers(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException, VoNotExistsException Return all users who can use this facility specificVo and specificService can choose concrete users if specificVo, specificService or both are null, they do not specific (all possible results are returned)- Parameters:
specificVo
- specific only those results which are in specific VO (with null, all results)specificService
- specific only those results, which have resource with assigned specific service (if null, all results)- Returns:
- list of users
- Throws:
ServiceNotExistsException
- if service is not null and not existVoNotExistsException
- if vo is not null and not existPrivilegeException
FacilityNotExistsException
-
getAllowedVos
List<Vo> getAllowedVos(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Return all VO which can use this facility. (VO muset have the resource which belongs to this facility)- Returns:
- list of Vos
- Throws:
PrivilegeException
FacilityNotExistsException
-
getAssignedFacilities
List<Facility> getAssignedFacilities(PerunSession sess, Group group) throws PrivilegeException, GroupNotExistsException Get facilities which are assigned to Group (via resource). -
getAssignedFacilities
List<Facility> getAssignedFacilities(PerunSession sess, Member member) throws PrivilegeException, MemberNotExistsException Get facilities which have the member access on. -
getAssignedFacilities
List<Facility> getAssignedFacilities(PerunSession sess, User user) throws PrivilegeException, UserNotExistsException Get facilities which have the user access on. -
getAssignedFacilities
List<Facility> getAssignedFacilities(PerunSession sess, Service service) throws PrivilegeException, ServiceNotExistsException Get facilities where the service is defined. -
getAssignedFacilities
List<Facility> getAssignedFacilities(PerunSession sess, SecurityTeam securityTeam) throws PrivilegeException, SecurityTeamNotExistsException Get facilities where security team is assigned. -
getAssignedResources
List<Resource> getAssignedResources(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Returns all resources assigned to the facility.- Returns:
- list of resources assigned to the facility
- Throws:
PrivilegeException
FacilityNotExistsException
-
getAssignedResourcesByAssignedService
List<Resource> getAssignedResourcesByAssignedService(PerunSession perunSession, Facility facility, Service service) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Returns resources with specific service assigned to the facility.- Parameters:
perunSession
- perun sessionfacility
- facilityservice
- specific only those results, which have resource with assigned specific service- Returns:
- list of resources assigned to the facility by specific service
- Throws:
FacilityNotExistsException
- if facility does not existServiceNotExistsException
- if service does not existPrivilegeException
-
getAssignedRichResources
List<RichResource> getAssignedRichResources(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Returns all rich resources assigned to the facility with VO property filled- Returns:
- list of rich resources assigned to the facility
- Throws:
PrivilegeException
FacilityNotExistsException
-
getAssignedRichResources
List<RichResource> getAssignedRichResources(PerunSession perunSession, Facility facility, Service service) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Returns all rich resources assigned to the facility and service with VO property filled- Returns:
- list of rich resources assigned to the facility and service
- Throws:
PrivilegeException
FacilityNotExistsException
ServiceNotExistsException
-
getAssignedSecurityTeams
List<SecurityTeam> getAssignedSecurityTeams(PerunSession sess, Facility facility) throws PrivilegeException, FacilityNotExistsException return assigned security teams for specific facility- Returns:
- assigned security teams fot given facility
- Throws:
PrivilegeException
- can do only PerunAdmin or FacilityAdmin of the facilityFacilityNotExistsException
-
getAssignedUsers
List<User> getAssignedUsers(PerunSession sess, Facility facility) throws PrivilegeException, FacilityNotExistsException Returns list of Users, assigned with chosen Facility.- Returns:
- list of users
- Throws:
PrivilegeException
FacilityNotExistsException
-
getAssignedUsers
List<User> getAssignedUsers(PerunSession sess, Facility facility, Service service) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Returns list of Users assigned with chosen Facility containing resources where service is assigned.- Returns:
- list of users
- Throws:
PrivilegeException
FacilityNotExistsException
ServiceNotExistsException
-
getBan
BanOnFacility getBan(PerunSession sess, int userId, int faclityId) throws BanNotExistsException, PrivilegeException, UserNotExistsException, FacilityNotExistsException Get ban by userId and facilityId.- Parameters:
userId
- the id of userfaclityId
- the id of facility- Returns:
- specific ban for user on facility
- Throws:
BanNotExistsException
PrivilegeException
UserNotExistsException
FacilityNotExistsException
-
getBanById
BanOnFacility getBanById(PerunSession sess, int banId) throws BanNotExistsException, PrivilegeException Get Ban for user on facility by it's id- Parameters:
banId
- the id of ban- Returns:
- facility ban by it's id
- Throws:
BanNotExistsException
PrivilegeException
-
getBansForFacility
List<BanOnFacility> getBansForFacility(PerunSession sess, int facilityId) throws PrivilegeException, FacilityNotExistsException Get all bans for users on the facility- Parameters:
facilityId
- the id of facility- Returns:
- list of bans for all users on the facility
- Throws:
PrivilegeException
FacilityNotExistsException
-
getBansForUser
Get all bans for user on any facility.- Parameters:
userId
- the id of user- Returns:
- list of bans for user on any facility
- Throws:
UserNotExistsException
-
getDirectAdmins
@Deprecated List<User> getDirectAdmins(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Deprecated.Gets list of direct user administrators of the Facility. 'Direct' means, there aren't included users, who are members of group administrators, in the returned list. -
getDirectRichAdminsWithSpecificAttributes
@Deprecated List<RichUser> getDirectRichAdminsWithSpecificAttributes(PerunSession perunSession, Facility facility, List<String> specificAttributes) throws PrivilegeException, FacilityNotExistsException Deprecated.Get list of Facility administrators, which are assigned directly (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)- Returns:
- list of RichUsers with specific attributes.
- Throws:
PrivilegeException
FacilityNotExistsException
-
getEnrichedBansForFacility
List<EnrichedBanOnFacility> getEnrichedBansForFacility(PerunSession sess, int facilityId, List<String> attrNames) throws PrivilegeException, FacilityNotExistsException, AttributeNotExistsException Get all enriched bans for users on the facility.- Parameters:
sess
-facilityId
- id of the facilityattrNames
- list of attribute names, returns all user attributes if null or empty- Returns:
- list of enriched bans on facility
- Throws:
PrivilegeException
FacilityNotExistsException
AttributeNotExistsException
-
getEnrichedBansForUser
List<EnrichedBanOnFacility> getEnrichedBansForUser(PerunSession sess, int userId, List<String> attrNames) throws PrivilegeException, UserNotExistsException, AttributeNotExistsException Get all enriched bans on facility for user.- Parameters:
sess
-userId
- id of userattrNames
- list of attributes names, returns all user/member attributes if null or empty- Returns:
- list of user's enriched bans on assigned facilities
- Throws:
PrivilegeException
UserNotExistsException
AttributeNotExistsException
-
getEnrichedFacilities
Gets all enriched facilities user has access rights to. If User is: - PERUNADMIN : all facilities - FACILITYADMIN : only facilities where user is facility admin - FACILITYOBSERVER: only facilities where user is facility observer- Parameters:
perunSession
-- Returns:
- List of all EnrichedFacilities
- Throws:
PrivilegeException
- insufficient permissions
-
getEnrichedHosts
List<EnrichedHost> getEnrichedHosts(PerunSession sess, Facility facility, List<String> attrNames) throws AttributeNotExistsException, FacilityNotExistsException, PrivilegeException Return all EnrichedHosts of given facility. That is host with attributes given by attrNames.- Parameters:
sess
- perun sessionfacility
- facilityattrNames
- attribute names- Returns:
- list of enriched hosts
- Throws:
AttributeNotExistsException
- if some attribute does not existFacilityNotExistsException
- if facility does not existPrivilegeException
- if user has insufficient permissions
-
getFacilities
List facilities by ACCESS RIGHTS: If User is: - PERUNADMIN : all facilities - FACILITYADMIN : only facilities where user is facility admin- Returns:
- List of all Facilities within the Perun
- Throws:
PrivilegeException
-
getFacilitiesByAttribute
List<Facility> getFacilitiesByAttribute(PerunSession sess, String attributeName, String attributeValue) throws PrivilegeException, AttributeNotExistsException, WrongAttributeAssignmentException Returns all facilities that have set the attribute 'attributeName' with the value 'attributeValue'. Searching only def and opt attributes. Large attributes are not supported.- Parameters:
attributeName
- name of the attributeattributeValue
- value of the attribute- Returns:
- list of facilities
- Throws:
PrivilegeException
AttributeNotExistsException
WrongAttributeAssignmentException
-
getFacilitiesByAttributeWithAttributes
List<FacilityWithAttributes> getFacilitiesByAttributeWithAttributes(PerunSession sess, String searchAttributeName, String searchAttributeValue, List<String> attrNames) throws PrivilegeException, AttributeNotExistsException Searches (partially!) for facilities with the attribute 'searchAttributeName' and its value 'searchAttributeValue'. Found Facilities are returned along with attributes listed in 'attrNames'.- Parameters:
sess
-searchAttributeName
- name of the attribute to search bysearchAttributeValue
- value to search forattrNames
- names of attributes to return with facilities- Returns:
- list of facilities with attributes
- Throws:
PrivilegeException
AttributeNotExistsException
- when the attribute to search by does not exist
-
getFacilitiesByDestination
List<Facility> getFacilitiesByDestination(PerunSession perunSession, String destination) throws FacilityNotExistsException, PrivilegeException Searches for the Facilities by theirs destination.- Returns:
- Facilities with specified name
- Throws:
FacilityNotExistsException
- //FIXME proc tato vyjimka?PrivilegeException
-
getFacilitiesByHostName
Return all facilities where exists host with the specific hostname- Parameters:
hostname
- specific hostname
-
getFacilitiesByIds
List<Facility> getFacilitiesByIds(PerunSession perunSession, List<Integer> ids) throws PrivilegeException Searches for the Facilities with specified ids.- Parameters:
perunSession
-ids
-- Returns:
- list of Facilities with specified ids
- Throws:
PrivilegeException
-
getFacilitiesCount
Get count of all facilities.- Returns:
- count of all facilities
-
getFacilitiesWhereUserIsAdmin
List<Facility> getFacilitiesWhereUserIsAdmin(PerunSession sess, User user) throws UserNotExistsException, PrivilegeException Get all facilities where the user is admin. Including facilities, where the user is a VALID member of authorized group.- Returns:
- list of Facilities, where the user is an admin.
- Throws:
UserNotExistsException
PrivilegeException
-
getFacilityById
Facility getFacilityById(PerunSession perunSession, int id) throws FacilityNotExistsException, PrivilegeException Searches for the Facility with specified id.- Returns:
- Facility with specified id
- Throws:
FacilityNotExistsException
PrivilegeException
-
getFacilityByName
Facility getFacilityByName(PerunSession perunSession, String name) throws FacilityNotExistsException, PrivilegeException Searches the Facility by its name.- Returns:
- Facility with specified name
- Throws:
FacilityNotExistsException
PrivilegeException
-
getFacilityForHost
Facility getFacilityForHost(PerunSession sess, Host host) throws PrivilegeException, HostNotExistsException Return facility which has the host.- Returns:
- facility
- Throws:
PrivilegeException
HostNotExistsException
-
getHostById
Get the host by its ID.- Returns:
- host
- Throws:
HostNotExistsException
PrivilegeException
-
getHosts
List<Host> getHosts(PerunSession sess, Facility facility) throws FacilityNotExistsException, PrivilegeException List hosts of Facility.- Returns:
- hosts
- Throws:
FacilityNotExistsException
PrivilegeException
-
getHostsByHostname
Get all hosts with this hostname (from all facilities).Facility Admin get only those which are from his facilities.
- Returns:
- list of hosts by hostname
- Throws:
PrivilegeException
-
getHostsCount
int getHostsCount(PerunSession sess, Facility facility) throws FacilityNotExistsException, PrivilegeException Count hosts of Facility.- Returns:
- the number of hosts present in the facility
- Throws:
FacilityNotExistsException
PrivilegeException
-
getOwnerFacilities
List<Facility> getOwnerFacilities(PerunSession perunSession, Owner owner) throws OwnerNotExistsException, PrivilegeException Returns list of all facilities owned by the owner.- Returns:
- list of facilities owned by the owner
- Throws:
OwnerNotExistsException
PrivilegeException
-
getOwners
List<Owner> getOwners(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Returns owners of the facility.- Returns:
- owners of specified facility
- Throws:
PrivilegeException
FacilityNotExistsException
-
getRichAdmins
@Deprecated List<RichUser> getRichAdmins(PerunSession perunSession, Facility facility, List<String> specificAttributes, boolean allUserAttributes, boolean onlyDirectAdmins) throws UserNotExistsException, PrivilegeException, FacilityNotExistsException Deprecated.Gets list of all richUser administrators of the Facility. If some group is administrator of the given group, all VALID members are included in the list.Supported roles: FacilityAdmin
If "onlyDirectAdmins" is "true", return only direct users of the group 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:
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 facility and supported role with attributes
- Throws:
UserNotExistsException
PrivilegeException
FacilityNotExistsException
-
getRichAdmins
@Deprecated List<RichUser> getRichAdmins(PerunSession sess, Facility facility) throws FacilityNotExistsException, PrivilegeException Deprecated.Get all Facility admins without attributes.- Returns:
- return list of RichUsers without attributes.
- Throws:
FacilityNotExistsException
PrivilegeException
-
getRichAdminsWithAttributes
@Deprecated List<RichUser> getRichAdminsWithAttributes(PerunSession sess, Facility facility) throws UserNotExistsException, PrivilegeException, FacilityNotExistsException Deprecated.Get all Facility admins with attributes.- Returns:
- list of RichUsers who are admins in the facility WITH ATTRIBUTES.
- Throws:
UserNotExistsException
PrivilegeException
FacilityNotExistsException
-
getRichAdminsWithSpecificAttributes
@Deprecated List<RichUser> getRichAdminsWithSpecificAttributes(PerunSession perunSession, Facility facility, List<String> specificAttributes) throws PrivilegeException, FacilityNotExistsException Deprecated.Get list of Facility administrators with specific attributes. From list of specificAttributes get all Users Attributes and find those for every RichAdmin (only, other attributes are not searched)- Returns:
- list of RichUsers with specific attributes.
- Throws:
PrivilegeException
FacilityNotExistsException
-
getRichFacilities
Get all possible rich Facilities with all their owners. For PerunAdmin get All richFacilities. For FacilityAdmin get only richFacilities under his administration.- Returns:
- list of RichFacilities with owners
- Throws:
PrivilegeException
-
removeAdmin
void removeAdmin(PerunSession sess, Facility facility, User user) throws FacilityNotExistsException, UserNotExistsException, PrivilegeException, UserNotAdminException, RoleCannotBeManagedException Removes a user administrator from the Facility. -
removeAdmin
void removeAdmin(PerunSession sess, Facility facility, Group group) throws FacilityNotExistsException, GroupNotExistsException, PrivilegeException, GroupNotAdminException, RoleCannotBeManagedException Removes a group administrator from the Facility.- Parameters:
group
- group that will lose a Facility administrator role- Throws:
FacilityNotExistsException
GroupNotExistsException
PrivilegeException
GroupNotAdminException
RoleCannotBeManagedException
-
removeBan
void removeBan(PerunSession sess, int banId) throws BanNotExistsException, PrivilegeException, FacilityNotExistsException Remove existing ban by it's id.- Parameters:
banId
- the id of ban- Throws:
BanNotExistsException
PrivilegeException
FacilityNotExistsException
-
removeBan
void removeBan(PerunSession sess, int userId, int facilityId) throws BanNotExistsException, PrivilegeException, FacilityNotExistsException Remove existing ban by id of user and facility.- Parameters:
userId
- the id of userfacilityId
- the id of facility- Throws:
BanNotExistsException
PrivilegeException
FacilityNotExistsException
-
removeHost
void removeHost(PerunSession perunSession, Host host) throws HostNotExistsException, PrivilegeException, HostAlreadyRemovedException Remove hosts from the Facility.- Throws:
HostAlreadyRemovedException
- if there are 0 rows affected by deleting from DBHostNotExistsException
PrivilegeException
-
removeHostByHostname
void removeHostByHostname(PerunSession perunSession, String hostname) throws InternalErrorException, HostNotExistsException, HostAlreadyRemovedException, PrivilegeException Remove host from the Facility based on hostname. If there is ambiguity, method throws exception and no host is removed.- Throws:
HostAlreadyRemovedException
- if there are 0 rows affected by deleting from DBHostNotExistsException
- if there is ambiguity in host to removeInternalErrorException
PrivilegeException
-
removeHosts
void removeHosts(PerunSession sess, List<Host> hosts, Facility facility) throws FacilityNotExistsException, PrivilegeException, HostAlreadyRemovedException Remove hosts from the Facility.- Throws:
HostAlreadyRemovedException
- if there is at least 1 host not affected by deleting from DBFacilityNotExistsException
PrivilegeException
-
removeOwner
void removeOwner(PerunSession perunSession, Facility facility, Owner owner) throws PrivilegeException, OwnerNotExistsException, FacilityNotExistsException, OwnerAlreadyRemovedException Remove owner of the facility -
removeOwners
void removeOwners(PerunSession sess, Facility facility, List<Owner> owners) throws PrivilegeException, OwnerNotExistsException, FacilityNotExistsException, OwnerAlreadyRemovedException Remove owners of the facility- Parameters:
sess
- perun sessionfacility
- facilityowners
- list of owners to be removed- Throws:
PrivilegeException
- when the principal does not have sufficient rightsOwnerNotExistsException
- when owner does not existFacilityNotExistsException
- when facility does not existOwnerAlreadyRemovedException
- when owner was already removed from the facility
-
removeSecurityTeam
void removeSecurityTeam(PerunSession sess, Facility facility, SecurityTeam securityTeam) throws PrivilegeException, FacilityNotExistsException, SecurityTeamNotExistsException, SecurityTeamNotAssignedException Remove (Unassign) given security team from given facility- Throws:
PrivilegeException
- can do only PerunAdmin or FacilityAdmin of the facilityFacilityNotExistsException
SecurityTeamNotExistsException
SecurityTeamNotAssignedException
-
setBan
BanOnFacility setBan(PerunSession sess, BanOnFacility banOnFacility) throws PrivilegeException, BanAlreadyExistsException, UserNotExistsException, FacilityNotExistsException Set ban for user on facility.- Parameters:
banOnFacility
- the ban- Returns:
- ban on facility
- Throws:
PrivilegeException
BanAlreadyExistsException
UserNotExistsException
FacilityNotExistsException
-
setOwners
@Deprecated void setOwners(PerunSession perunSession, Facility facility, List<Owner> owners) throws PrivilegeException, FacilityNotExistsException, OwnerNotExistsException Deprecated.Use addOwner and removeOwner insteadUpdates owners of facility -
updateBan
BanOnFacility updateBan(PerunSession sess, BanOnFacility banOnFacility) throws PrivilegeException, FacilityNotExistsException, UserNotExistsException, BanNotExistsException Update existing ban (description and validation timestamp)- Parameters:
banOnFacility
- the existing ban- Returns:
- updated ban
- Throws:
PrivilegeException
FacilityNotExistsException
UserNotExistsException
BanNotExistsException
-
updateFacility
Facility updateFacility(PerunSession perunSession, Facility facility) throws FacilityNotExistsException, FacilityExistsException, PrivilegeException, ConsentHubExistsException Updates facility.- Parameters:
facility
- to update- Returns:
- updated facility
- Throws:
FacilityExistsException
FacilityNotExistsException
InternalErrorException
PrivilegeException
ConsentHubExistsException
-