Interface ServicesManager
- All Known Implementing Classes:
ServicesManagerEntry
- Author:
- Michal Prochazka invalid input: '<'michalp@ics.muni.cz>, Slavek Licehammer invalid input: '<'glory@ics.muni.cz>
Note: ServicesManager is not to be used directly by any client. ServicesManager's functionality is going to be encapsulated in the Controller's GeneralServiceManager.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaddDestination
(PerunSession perunSession, Service service, Facility facility, Destination destination) Adds an destination for the facility and service.addDestination
(PerunSession perunSession, List<Service> services, Facility facility, Destination destination) Adds an destination for the facility and all services.addDestinationsDefinedByHostsOnFacility
(PerunSession perunSession, Facility facility) Defines services destination for all hosts using their hostnames.addDestinationsDefinedByHostsOnFacility
(PerunSession perunSession, Service service, Facility facility) Defines service destination for all hosts using theirs hostnames.addDestinationsDefinedByHostsOnFacility
(PerunSession perunSession, List<Service> services, Facility facility) Defines services destination for all hosts using their hostnames.addDestinationsForAllServicesOnFacility
(PerunSession perunSession, Facility facility, Destination destination) Adds destination for all services defined on the facility.void
addRequiredAttribute
(PerunSession perunSession, Service service, AttributeDefinition attribute) Mark the attribute as required for the service.void
addRequiredAttributes
(PerunSession perunSession, Service service, List<? extends AttributeDefinition> attributes) Batch version of addRequiredAttributevoid
addServiceToServicesPackage
(PerunSession perunSession, ServicesPackage servicesPackage, Service service) Add the service to the packagevoid
blockAllServicesOnDestination
(PerunSession perunSession, int destinationId) Block all services currently assigned on this destination.void
blockAllServicesOnFacility
(PerunSession perunSession, Facility facility) Block all services currently assigned on this facility.void
blockServiceOnDestination
(PerunSession perunSession, Service service, int destinationId) Bans Service on destination.void
blockServiceOnFacility
(PerunSession perunSession, Service service, Facility facility) Bans Service on facility.void
blockServicesOnDestinations
(PerunSession perunSession, List<RichDestination> richDestinations) Bans the Service on the destination - each pair defined by the rich destination.void
blockServicesOnFacility
(PerunSession sess, List<Service> services, Facility facility) Bans services on facility.createService
(PerunSession perunSession, Service service) Creates new service.createServicesPackage
(PerunSession perunSession, ServicesPackage servicesPackage) Insert a new packagevoid
deleteService
(PerunSession perunSession, Service service, boolean forceFlag) Deletes the service.void
deleteServices
(PerunSession perunSession, List<Service> services, boolean forceFlag) Deletes given services.void
deleteServicesPackage
(PerunSession perunSession, ServicesPackage servicesPackage) Remove the packageboolean
forceServicePropagation
(PerunSession perunSession, Facility facility, Service service) Forces service propagation on defined facility.boolean
forceServicePropagation
(PerunSession perunSession, Service service) Forces service propagation on all facilities where the service is defined on.void
forceServicePropagationBulk
(PerunSession sess, Facility facility, List<Service> services) Forces services propagation on defined facility.void
forceServicePropagationBulk
(PerunSession sess, List<Service> services) Forces services propagation on all facilities where the services are defined on.forceServicePropagationForHostname
(PerunSession perunSession, String hostname) Forces service propagation on all facilities for all services where hostname is used.getAllRichDestinations
(PerunSession perunSession, Facility facility) Get list of all rich destinations defined for the facility.getAllRichDestinations
(PerunSession perunSession, Service service) Get list of all rich destinations defined for the service.getAssignedResources
(PerunSession sess, Service service) Get all resources where the service is defined.getAssignedServices
(PerunSession perunSession, Facility facility) List all services associated with the facility (via resource).getAssignedServices
(PerunSession perunSession, Facility facility, Vo vo) List all services associated with the facility and vo (via resource).getDestinationById
(PerunSession perunSession, int id) Get destination by idint
getDestinationIdByName
(PerunSession sess, String name, String type) Return ID of Destination by its value (name) and type.getDestinations
(PerunSession perunSession) Get list of all destinations.getDestinations
(PerunSession perunSession, Service service, Facility facility) Get list of all destinations defined for the service and facility.int
Get count of all destinations.getFacilitiesDestinations
(PerunSession sess, Vo vo) List all destinations for all facilities which are joined by resources to the VO.getFacilityAssignedServicesForGUI
(PerunSession perunSession, Facility facility) Return list of ServiceForGUI assigned on facility, (Service with "allowedOnFacility" property filled). 1 - allowed / 0 - service is denied).getHashedDataWithGroups
(PerunSession perunSession, Service service, Facility facility, boolean consentEval, int taskRunId) Generates hashed data with group structure for given service and facility.getHashedHierarchicalData
(PerunSession perunSession, Service service, Facility facility, boolean consentEval, int taskRunId) Generates hashed hierarchical data structure for given service and facility.getRichDestinations
(PerunSession perunSession, Facility facility, Service service) Get list of all rich destinations defined for the facility and the service.getServiceById
(PerunSession perunSession, int id) Get service by id.getServiceByName
(PerunSession perunSession, String name) Get service by name.getServices
(PerunSession perunSession) get all services in perungetServicesBlockedOnDestination
(PerunSession perunSession, int destinationId) List all the Services that are banned on this destination.getServicesBlockedOnFacility
(PerunSession perunSession, Facility facility) List all the Services that are banned on this facility.getServicesByAttributeDefinition
(PerunSession sess, AttributeDefinition attributeDefinition) Get all services with given attribute.getServicesFromServicesPackage
(PerunSession perunSession, ServicesPackage servicesPackage) List services stored in the packagesgetServicesPackageById
(PerunSession perunSession, int servicesPackageId) Get package by IdgetServicesPackageByName
(PerunSession perunSession, String name) Get package by namegetServicesPackages
(PerunSession perunSession) List packagesboolean
isServiceBlockedOnDestination
(PerunSession sess, Service service, int destinationId) Is this Service denied on the destination?boolean
isServiceBlockedOnFacility
(PerunSession sess, Service service, Facility facility) Is this Service denied on the facility?boolean
planServicePropagation
(PerunSession perunSession, Facility facility, Service service) Plans service propagation on defined facility.boolean
planServicePropagation
(PerunSession perunSession, Service service) Forces service propagation on all facilities where the service is defined on.void
removeAllDestinations
(PerunSession perunSession, Service service, Facility facility) Removes all defined destinations for the service and facility.void
removeAllRequiredAttributes
(PerunSession perunSession, Service service) Detate all required attributes from servicevoid
removeDestination
(PerunSession perunSession, Service service, Facility facility, Destination destination) Removes an destination from the facility and service.void
removeDestinationsByRichDestinations
(PerunSession perunSession, List<RichDestination> richDestinations) Removes destinations defined by list of rich destinations.void
removeRequiredAttribute
(PerunSession perunSession, Service service, AttributeDefinition attribute) Remove required attribute from service.void
removeRequiredAttributes
(PerunSession perunSession, Service service, List<? extends AttributeDefinition> attributes) Batch version of removeRequiredAttributevoid
removeServiceFromServicesPackage
(PerunSession perunSession, ServicesPackage servicesPackage, Service service) Remove Service from Services Packagevoid
unblockAllServicesOnDestination
(PerunSession perunSession, int destinationId) Erase all the possible denials on this destination.void
unblockAllServicesOnDestination
(PerunSession sess, String destinationName) Erase all the possible denials on destinations defined by the destinationName.void
unblockAllServicesOnFacility
(PerunSession perunSession, Facility facility) Erase all the possible denials on this facility.void
unblockServiceOnDestination
(PerunSession perunSession, Service service, int destinationId) Free the denial of the Service on this destination.void
unblockServiceOnFacility
(PerunSession perunSession, Service service, Facility facility) Free the denial of the Service on this facility.void
unblockServicesOnDestinations
(PerunSession perunSession, List<RichDestination> richDestinations) Free the denial of the Service on the destination - each pair defined by the rich destination.void
unblockServicesOnFacility
(PerunSession sess, List<Service> services, Facility facility) Free the denial of the services on this facility.void
updateService
(PerunSession perunSession, Service service) Updates the service.void
updateServicesPackage
(PerunSession perunSession, ServicesPackage servicesPackage) Update package
-
Field Details
-
SERVICE_NAME_REGEXP
- See Also:
-
-
Method Details
-
addDestination
Destination addDestination(PerunSession perunSession, Service service, Facility facility, Destination destination) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyAssignedException, WrongPatternException Adds an destination for the facility and service. Destination.id doesn't need to be filled. If destination doesn't exist it will be created.- Parameters:
perunSession
-service
-facility
-destination
- (Id of this destination doesn't need to be filled.)- Returns:
- destination with it's id set.
- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
DestinationAlreadyAssignedException
WrongPatternException
-
addDestination
Destination addDestination(PerunSession perunSession, List<Service> services, Facility facility, Destination destination) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, WrongPatternException Adds an destination for the facility and all services. Destination id doesn't need to be filled. If destination doesn't exist it will be created.- Parameters:
perunSession
-services
-facility
-destination
- (id of this destination doesn't need to be filled.)- Returns:
- destination with it's id set
- Throws:
PrivilegeException
ServiceNotExistsException
FacilityNotExistsException
WrongPatternException
-
addDestinationsDefinedByHostsOnFacility
List<Destination> addDestinationsDefinedByHostsOnFacility(PerunSession perunSession, Service service, Facility facility) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyAssignedException Defines service destination for all hosts using theirs hostnames.- Parameters:
perunSession
-service
-facility
-- Returns:
- list of added destinations
- Throws:
PrivilegeException
InternalErrorException
ServiceNotExistsException
FacilityNotExistsException
DestinationAlreadyAssignedException
-
addDestinationsDefinedByHostsOnFacility
List<Destination> addDestinationsDefinedByHostsOnFacility(PerunSession perunSession, List<Service> services, Facility facility) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException Defines services destination for all hosts using their hostnames. Do it for all services in List.If some destination for service and facility already exist, do not create it but still return back in the list.
- Parameters:
perunSession
-services
-facility
-- Returns:
- list of added destinations (even if they already was added before)
- Throws:
PrivilegeException
InternalErrorException
ServiceNotExistsException
FacilityNotExistsException
-
addDestinationsDefinedByHostsOnFacility
List<Destination> addDestinationsDefinedByHostsOnFacility(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Defines services destination for all hosts using their hostnames. Use all assigned services to resources for the facility.If some destination for service and facility already exist, do not create it but still return back in the list.
- Parameters:
perunSession
-facility
-- Returns:
- list of added destinations (even if they already was added before)
- Throws:
PrivilegeException
InternalErrorException
FacilityNotExistsException
-
addDestinationsForAllServicesOnFacility
List<Destination> addDestinationsForAllServicesOnFacility(PerunSession perunSession, Facility facility, Destination destination) throws PrivilegeException, FacilityNotExistsException, DestinationAlreadyAssignedException, WrongPatternException Adds destination for all services defined on the facility.- Parameters:
perunSession
-facility
-destination
-- Returns:
- list of added destinations
- Throws:
PrivilegeException
FacilityNotExistsException
DestinationAlreadyAssignedException
WrongPatternException
-
addRequiredAttribute
void addRequiredAttribute(PerunSession perunSession, Service service, AttributeDefinition attribute) throws PrivilegeException, AttributeNotExistsException, ServiceNotExistsException, AttributeAlreadyAssignedException, ServiceAttributesCannotExtend Mark the attribute as required for the service. Required attribues are requisite for Service to run. If you add attribute which has a default attribute then this default attribute will be automatically add too.- Parameters:
perunSession
- perunSessionservice
- service to which the attribute will be addedattribute
- attribute to add- Throws:
InternalErrorException
- if an exception raise in concrete implementation, the exception is wrapped in InternalErrorExceptionPrivilegeException
- if privileges are not givenAttributeNotExistsException
- if the attribute doesn't exists in underlaying data sourceServiceNotExistsException
- if the service doesn't exists in underlaying data sourceAttributeAlreadyAssignedException
- if the attribute is already addedServiceAttributesCannotExtend
- if trying to add user-related attribute that could invalidate consents
-
addRequiredAttributes
void addRequiredAttributes(PerunSession perunSession, Service service, List<? extends AttributeDefinition> attributes) throws PrivilegeException, AttributeNotExistsException, ServiceNotExistsException, AttributeAlreadyAssignedException, ServiceAttributesCannotExtend Batch version of addRequiredAttribute -
addServiceToServicesPackage
void addServiceToServicesPackage(PerunSession perunSession, ServicesPackage servicesPackage, Service service) throws ServicesPackageNotExistsException, ServiceNotExistsException, ServiceAlreadyAssignedException, PrivilegeException Add the service to the package- Parameters:
perunSession
-servicesPackage
- services package to which the service supposed to be addedservice
- service to be added to the services package- Throws:
InternalErrorException
PrivilegeException
ServicesPackageNotExistsException
ServiceNotExistsException
ServiceAlreadyAssignedException
-
blockAllServicesOnDestination
void blockAllServicesOnDestination(PerunSession perunSession, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException Block all services currently assigned on this destination. From this moment on, there are no Services being allowed on this destination. If you assign a new service to the destination, it will be allowed!- Parameters:
perunSession
-destinationId
- The id of a destination we want to block all services on.- Throws:
InternalErrorException
PrivilegeException
DestinationNotExistsException
FacilityNotExistsException
-
blockAllServicesOnFacility
void blockAllServicesOnFacility(PerunSession perunSession, Facility facility) throws FacilityNotExistsException, PrivilegeException Block all services currently assigned on this facility. From this moment on, there are no Services being allowed on this facility. If you assign a new service to the facility, it will be allowed!- Parameters:
perunSession
-facility
- Facility we want to block all services on.- Throws:
InternalErrorException
FacilityNotExistsException
PrivilegeException
-
blockServiceOnDestination
void blockServiceOnDestination(PerunSession perunSession, Service service, int destinationId) throws PrivilegeException, DestinationNotExistsException, ServiceAlreadyBannedException, FacilityNotExistsException Bans Service on destination. It wouldn't be possible to execute the given Service on this destination, however, it still can be executed on all the other destinations in the facility.- Parameters:
perunSession
-service
- The Service to be banned on this particular destinationdestinationId
- The destination on which we want to ban the Service- Throws:
InternalErrorException
PrivilegeException
DestinationNotExistsException
ServiceAlreadyBannedException
FacilityNotExistsException
-
blockServiceOnFacility
void blockServiceOnFacility(PerunSession perunSession, Service service, Facility facility) throws ServiceAlreadyBannedException, PrivilegeException Bans Service on facility. It wouldn't be possible to execute the given Service on the whole facility nor on any of its destinations.- Parameters:
perunSession
-service
- The Service to be banned on the facilityfacility
- The facility on which we want to ban the Service- Throws:
InternalErrorException
ServiceAlreadyBannedException
PrivilegeException
-
blockServicesOnDestinations
void blockServicesOnDestinations(PerunSession perunSession, List<RichDestination> richDestinations) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException Bans the Service on the destination - each pair defined by the rich destination. It wouldn't be possible to execute the given Service on this destination, however, it still can be executed on all the other destinations in the facility.- Parameters:
perunSession
-richDestinations
- the list of rich destinations- Throws:
PrivilegeException
DestinationNotExistsException
FacilityNotExistsException
-
blockServicesOnFacility
void blockServicesOnFacility(PerunSession sess, List<Service> services, Facility facility) throws ServiceAlreadyBannedException, PrivilegeException, FacilityNotExistsException Bans services on facility. It wouldn't be possible to execute the given services on the whole facility nor on any of their destinations.- Parameters:
sess
- perun sessionservices
- list of servicesfacility
- The facility on which we want to ban services- Throws:
PrivilegeException
- insufficient permissionsServiceAlreadyBannedException
- when service was already bannedFacilityNotExistsException
- when facility does not exist
-
createService
Service createService(PerunSession perunSession, Service service) throws PrivilegeException, ServiceExistsException Creates new service.- Parameters:
perunSession
-service
-- Returns:
- new service
- Throws:
InternalErrorException
PrivilegeException
ServiceExistsException
-
createServicesPackage
ServicesPackage createServicesPackage(PerunSession perunSession, ServicesPackage servicesPackage) throws PrivilegeException, ServicesPackageExistsException Insert a new package- Parameters:
perunSession
-servicesPackage
- package to be inserted- Returns:
- ServicesPackage object completely filled (including Id)
- Throws:
InternalErrorException
PrivilegeException
ServicesPackageExistsException
-
deleteService
void deleteService(PerunSession perunSession, Service service, boolean forceFlag) throws ServiceNotExistsException, PrivilegeException, RelationExistsException, ServiceAlreadyRemovedException Deletes the service.- Parameters:
perunSession
-service
-forceFlag
- if true, removes all dependant objects from database instead of raising exception- Throws:
InternalErrorException
ServiceNotExistsException
PrivilegeException
RelationExistsException
ServiceAlreadyRemovedException
- if there are 0 rows affected by deleting from DB
-
deleteServices
void deleteServices(PerunSession perunSession, List<Service> services, boolean forceFlag) throws ServiceNotExistsException, PrivilegeException, RelationExistsException, ServiceAlreadyRemovedException Deletes given services.- Parameters:
perunSession
-services
- list of servicesforceFlag
- if true, removes all dependant objects from database instead of raising exception- Throws:
InternalErrorException
ServiceNotExistsException
PrivilegeException
RelationExistsException
ServiceAlreadyRemovedException
- if there are 0 rows affected by deleting from DB
-
deleteServicesPackage
void deleteServicesPackage(PerunSession perunSession, ServicesPackage servicesPackage) throws ServicesPackageNotExistsException, PrivilegeException, RelationExistsException Remove the package- Parameters:
perunSession
-servicesPackage
- services package to be removed.- Throws:
ServicesPackageNotExistsException
RelationExistsException
PrivilegeException
InternalErrorException
-
forceServicePropagation
boolean forceServicePropagation(PerunSession perunSession, Facility facility, Service service) throws PrivilegeException Forces service propagation on defined facility.- Parameters:
perunSession
-facility
-service
-- Returns:
- true if it is possible, false if not
- Throws:
PrivilegeException
-
forceServicePropagation
boolean forceServicePropagation(PerunSession perunSession, Service service) throws PrivilegeException Forces service propagation on all facilities where the service is defined on.- Parameters:
perunSession
-service
-- Returns:
- true if it is possible, false if not
- Throws:
PrivilegeException
-
forceServicePropagationBulk
void forceServicePropagationBulk(PerunSession sess, Facility facility, List<Service> services) throws PrivilegeException, FacilityNotExistsException, ForceServicePropagationDisabledException Forces services propagation on defined facility.- Parameters:
sess
- perun sessionfacility
- facilityservices
- list of services- Throws:
FacilityNotExistsException
- when facility does not existPrivilegeException
- insufficient permissionsForceServicePropagationDisabledException
- when forcing propagation is not possible
-
forceServicePropagationBulk
void forceServicePropagationBulk(PerunSession sess, List<Service> services) throws PrivilegeException, ForceServicePropagationDisabledException Forces services propagation on all facilities where the services are defined on.- Parameters:
sess
- sessionservices
- list of services- Throws:
PrivilegeException
- insufficient permissionsForceServicePropagationDisabledException
- when forcing propagation is not possible
-
forceServicePropagationForHostname
String forceServicePropagationForHostname(PerunSession perunSession, String hostname) throws PrivilegeException Forces service propagation on all facilities for all services where hostname is used. Service must be correctly assigned, have destination matching hostname and not be blocked on any level (globally, facility, destination).- Parameters:
perunSession
-hostname
- Hostname to get facilities for- Returns:
- message Space separated list of forced services or error message (no facilities found, services are blocked)
- Throws:
PrivilegeException
-
getAllRichDestinations
List<RichDestination> getAllRichDestinations(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Get list of all rich destinations defined for the facility.- Parameters:
perunSession
-facility
-- Returns:
- Throws:
PrivilegeException
- if privileges are not givenInternalErrorException
- if an exception raise in concrete implementation, the exception is wrapped in InternalErrorExceptionFacilityNotExistsException
- if facility which we get from service and destination not existServiceNotExistsException
- if the service not exist
-
getAllRichDestinations
List<RichDestination> getAllRichDestinations(PerunSession perunSession, Service service) throws PrivilegeException, ServiceNotExistsException Get list of all rich destinations defined for the service.- Parameters:
perunSession
-service
-- Returns:
- Throws:
PrivilegeException
- if privileges are not givenInternalErrorException
- if an exception raise in concrete implementation, the exception is wrapped in InternalErrorExceptionFacilityNotExistsException
- if the facility not existServiceNotExistsException
- if service which we get from facility and destination not exist
-
getAssignedResources
List<Resource> getAssignedResources(PerunSession sess, Service service) throws PrivilegeException, ServiceNotExistsException Get all resources where the service is defined.- Parameters:
sess
-service
-- Returns:
- list of resources where the service is defined
- Throws:
InternalErrorException
PrivilegeException
ServiceNotExistsException
-
getAssignedServices
List<Service> getAssignedServices(PerunSession perunSession, Facility facility) throws FacilityNotExistsException, PrivilegeException List all services associated with the facility (via resource).- Parameters:
perunSession
-facility
-- Returns:
- list of services assigned to facility
- Throws:
InternalErrorException
FacilityNotExistsException
PrivilegeException
-
getAssignedServices
List<Service> getAssignedServices(PerunSession perunSession, Facility facility, Vo vo) throws FacilityNotExistsException, VoNotExistsException, PrivilegeException List all services associated with the facility and vo (via resource).- Parameters:
perunSession
-facility
-vo
-- Returns:
- list of services assigned to facility and vo
- Throws:
InternalErrorException
FacilityNotExistsException
VoNotExistsException
PrivilegeException
-
getDestinationById
Destination getDestinationById(PerunSession perunSession, int id) throws PrivilegeException, DestinationNotExistsException Get destination by id- Parameters:
perunSession
-id
-- Returns:
- Destination with the id
- Throws:
PrivilegeException
InternalErrorException
DestinationNotExistsException
-
getDestinationIdByName
int getDestinationIdByName(PerunSession sess, String name, String type) throws DestinationNotExistsException Return ID of Destination by its value (name) and type.- Parameters:
sess
-name
- Name (value) of Destinationtype
- Type of destination- Returns:
- ID of Destination
- Throws:
InternalErrorException
DestinationNotExistsException
-
getDestinations
List<Destination> getDestinations(PerunSession perunSession, Service service, Facility facility) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException Get list of all destinations defined for the service and facility.- Parameters:
perunSession
-service
-facility
-- Returns:
- list list of destinations defined for the service and facility
- Throws:
PrivilegeException
InternalErrorException
ServiceNotExistsException
FacilityNotExistsException
-
getDestinations
Get list of all destinations.- Parameters:
perunSession
-- Returns:
- list of all destinations for session
- Throws:
InternalErrorException
PrivilegeException
-
getFacilityAssignedServicesForGUI
List<ServiceForGUI> getFacilityAssignedServicesForGUI(PerunSession perunSession, Facility facility) throws PrivilegeException, FacilityNotExistsException Return list of ServiceForGUI assigned on facility, (Service with "allowedOnFacility" property filled). 1 - allowed / 0 - service is denied).- Parameters:
perunSession
-facility
-- Returns:
- list of assigned services with allowed property
- Throws:
PrivilegeException
FacilityNotExistsException
InternalErrorException
-
getHashedDataWithGroups
HashedGenData getHashedDataWithGroups(PerunSession perunSession, Service service, Facility facility, boolean consentEval, int taskRunId) throws FacilityNotExistsException, ServiceNotExistsException, PrivilegeException Generates hashed data with group structure for given service and facility. If enforcing consents is turned on on the instance and on the resource's consent hub, generates only the users that granted a consent to all the service required attributes. New UNSIGNED consents are created to users that don't have a consent containing all the service required attributes.Generates data in format:
attributes: {...hashes...} hierarchy: { "1": { ** facility id ** members: { ** all members on the facility ** "4" : 5, ** member id : user id ** "6" : 7, ** member id : user id ** ... } children: [ "2": { ** resource id ** voId: 99, children: [ "89": { ** group id ** "children": {}, "members": { "91328": 57986, "91330": 60838 } } ], "members": { ** all members on the resource with id 2 ** "91328": 57986, "91330": 60838 } }, "3": { ... } ] } }
- Parameters:
perunSession
- perun sessionservice
- servicefacility
- facilityconsentEval
- if the generator should force evaluation of consentstaskRunId
- Integer id of the task run propagation- Returns:
- generated hashed data structure
- Throws:
FacilityNotExistsException
- if there is no such facilityServiceNotExistsException
- if there is no such servicePrivilegeException
- insufficient permissions
-
getHashedHierarchicalData
HashedGenData getHashedHierarchicalData(PerunSession perunSession, Service service, Facility facility, boolean consentEval, int taskRunId) throws FacilityNotExistsException, ServiceNotExistsException, PrivilegeException Generates hashed hierarchical data structure for given service and facility. If enforcing consents is turned on on the instance and on the resource's consent hub, generates only the users that granted a consent to all the service required attributes. New UNSIGNED consents are created to users that don't have a consent containing all the service required attributes.attributes: {...hashes...} hierarchy: { "1": { ** facility id ** members: { ** all members on the facility ** "4" : 5, ** member id : user id ** "6" : 7, ** member id : user id ** ... } children: [ "2": { ** resource id ** children: [], voId: 99, members: { ** all members on the resource with id 2 ** "4" : 5 ** member id : user id ** } }, "3": { ... } ] } }
- Parameters:
perunSession
- perun sessionservice
- servicefacility
- facilityconsentEval
- if the generator should force evaluation of consentstaskRunId
- Integer id of the task run propagation- Returns:
- generated hashed data structure
- Throws:
FacilityNotExistsException
- if there is no such facilityServiceNotExistsException
- if there is no such servicePrivilegeException
- insufficient permissions
-
getRichDestinations
List<RichDestination> getRichDestinations(PerunSession perunSession, Facility facility, Service service) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Get list of all rich destinations defined for the facility and the service.- Parameters:
perunSession
-facility
-service
-- Returns:
- Throws:
PrivilegeException
- if privileges are not givenInternalErrorException
- if an exception raise in concrete implementation, the exception is wrapped in InternalErrorExceptionFacilityNotExistsException
- if the facility not existServiceNotExistsException
- if the service not exist
-
getServiceById
Service getServiceById(PerunSession perunSession, int id) throws PrivilegeException, ServiceNotExistsException Get service by id.- Parameters:
perunSession
-id
-- Returns:
- service with specified id
- Throws:
InternalErrorException
PrivilegeException
ServiceNotExistsException
-
getServiceByName
Service getServiceByName(PerunSession perunSession, String name) throws PrivilegeException, ServiceNotExistsException Get service by name.- Parameters:
perunSession
-name
- name of the service- Returns:
- service with specified name
- Throws:
InternalErrorException
PrivilegeException
ServiceNotExistsException
-
getServices
get all services in perun- Parameters:
perunSession
-- Returns:
- all services in perun
- Throws:
InternalErrorException
PrivilegeException
-
getServicesBlockedOnDestination
List<Service> getServicesBlockedOnDestination(PerunSession perunSession, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException List all the Services that are banned on this destination.- Parameters:
perunSession
-destinationId
-- Returns:
- a list of Services that are denied on the destination
- Throws:
PrivilegeException
DestinationNotExistsException
FacilityNotExistsException
-
getServicesBlockedOnFacility
List<Service> getServicesBlockedOnFacility(PerunSession perunSession, Facility facility) throws PrivilegeException List all the Services that are banned on this facility.- Parameters:
perunSession
-facility
-- Returns:
- a list of Services that are denied on the facility
- Throws:
PrivilegeException
-
getServicesByAttributeDefinition
List<Service> getServicesByAttributeDefinition(PerunSession sess, AttributeDefinition attributeDefinition) throws PrivilegeException Get all services with given attribute.- Parameters:
sess
- perun sessionattributeDefinition
-- Returns:
- all services with given attribute
- Throws:
InternalErrorException
PrivilegeException
-
getServicesFromServicesPackage
List<Service> getServicesFromServicesPackage(PerunSession perunSession, ServicesPackage servicesPackage) throws ServicesPackageNotExistsException, PrivilegeException List services stored in the packages- Parameters:
servicesPackage
- the package from which we want to list the services- Returns:
- list consisting services
- Throws:
InternalErrorException
PrivilegeException
ServicesPackageNotExistsException
-
getServicesPackageById
ServicesPackage getServicesPackageById(PerunSession perunSession, int servicesPackageId) throws ServicesPackageNotExistsException, PrivilegeException Get package by Id- Parameters:
perunSession
-servicesPackageId
- id of the package we want to retrieve- Returns:
- package
- Throws:
InternalErrorException
PrivilegeException
ServicesPackageNotExistsException
-
getServicesPackageByName
ServicesPackage getServicesPackageByName(PerunSession perunSession, String name) throws ServicesPackageNotExistsException, PrivilegeException Get package by name- Parameters:
perunSession
-name
- name of the services package- Returns:
- package
- Throws:
InternalErrorException
PrivilegeException
ServicesPackageNotExistsException
-
getServicesPackages
List packages- Parameters:
perunSession
-- Returns:
- list of packages in the DB
- Throws:
InternalErrorException
PrivilegeException
-
isServiceBlockedOnDestination
boolean isServiceBlockedOnDestination(PerunSession sess, Service service, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException Is this Service denied on the destination?- Parameters:
service
- The Service, the denial of which we want to examinedestinationId
- The destination on which we want to look up the denial of the Service- Returns:
- true - in case the Service is denied on the destination false - in case the Service in NOT denied on the destination
- Throws:
PrivilegeException
DestinationNotExistsException
FacilityNotExistsException
-
isServiceBlockedOnFacility
boolean isServiceBlockedOnFacility(PerunSession sess, Service service, Facility facility) throws PrivilegeException Is this Service denied on the facility?- Parameters:
service
- The Service, the denial of which we want to examinefacility
- The facility on which we want to look up the denial of the Service- Returns:
- true - in case the Service is denied on the facility false - in case the Service in NOT denied on the facility
- Throws:
PrivilegeException
-
planServicePropagation
boolean planServicePropagation(PerunSession perunSession, Facility facility, Service service) throws PrivilegeException Plans service propagation on defined facility.- Parameters:
perunSession
-facility
-service
-- Returns:
- true if it is possible, false if not
- Throws:
PrivilegeException
-
planServicePropagation
boolean planServicePropagation(PerunSession perunSession, Service service) throws PrivilegeException Forces service propagation on all facilities where the service is defined on.- Parameters:
perunSession
-service
-- Returns:
- true if it is possible, false if not
- Throws:
PrivilegeException
-
removeAllDestinations
void removeAllDestinations(PerunSession perunSession, Service service, Facility facility) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException Removes all defined destinations for the service and facility.- Parameters:
perunSession
-service
-facility
-- Throws:
PrivilegeException
InternalErrorException
ServiceNotExistsException
FacilityNotExistsException
-
removeAllRequiredAttributes
void removeAllRequiredAttributes(PerunSession perunSession, Service service) throws PrivilegeException, ServiceNotExistsException Detate all required attributes from service- Parameters:
perunSession
- perunSessionservice
- service from which the attributes will be removed- Throws:
InternalErrorException
- if an exception raise in concrete implementation, the exception is wrapped in InternalErrorExceptionPrivilegeException
- if privileges are not givenServiceNotExistsException
- if the service doesn't exists in underlaying data source
-
removeDestination
void removeDestination(PerunSession perunSession, Service service, Facility facility, Destination destination) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyRemovedException Removes an destination from the facility and service.- Parameters:
perunSession
-service
-facility
-destination
- string contains destination address (mail, url, hostname, ...)- Throws:
PrivilegeException
InternalErrorException
ServiceNotExistsException
FacilityNotExistsException
DestinationAlreadyRemovedException
-
removeDestinationsByRichDestinations
void removeDestinationsByRichDestinations(PerunSession perunSession, List<RichDestination> richDestinations) throws PrivilegeException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyRemovedException Removes destinations defined by list of rich destinations. Each destination is removed from the rich destination's facility and service.- Parameters:
perunSession
-richDestinations
- list of rich destinations- Throws:
PrivilegeException
InternalErrorException
ServiceNotExistsException
FacilityNotExistsException
DestinationAlreadyRemovedException
-
removeRequiredAttribute
void removeRequiredAttribute(PerunSession perunSession, Service service, AttributeDefinition attribute) throws PrivilegeException, AttributeNotExistsException, ServiceNotExistsException, AttributeNotAssignedException Remove required attribute from service. TODO If you try to remove attribute which is default for other Required attribute ...- Parameters:
perunSession
- perunSessionservice
- service from which the attribute will be removedattribute
- attribute to remove- Throws:
InternalErrorException
- if an exception raise in concrete implementation, the exception is wrapped in InternalErrorExceptionPrivilegeException
- if privileges are not givenAttributeNotExistsException
AttributeNotAssignedException
ServiceNotExistsException
- if the service doesn't exists in underlaying data source
-
removeRequiredAttributes
void removeRequiredAttributes(PerunSession perunSession, Service service, List<? extends AttributeDefinition> attributes) throws PrivilegeException, AttributeNotExistsException, ServiceNotExistsException, AttributeNotAssignedException Batch version of removeRequiredAttribute -
removeServiceFromServicesPackage
void removeServiceFromServicesPackage(PerunSession perunSession, ServicesPackage servicesPackage, Service service) throws ServicesPackageNotExistsException, ServiceNotExistsException, PrivilegeException, ServiceAlreadyRemovedFromServicePackageException Remove Service from Services Package- Parameters:
perunSession
-servicesPackage
- services package from which the service supposed to be removedservice
- service that will be removed from the services package- Throws:
InternalErrorException
PrivilegeException
ServicesPackageNotExistsException
ServiceAlreadyRemovedFromServicePackageException
- there are 0 rows affected by removing service from servicePackage in DBServiceNotExistsException
-
unblockAllServicesOnDestination
void unblockAllServicesOnDestination(PerunSession sess, String destinationName) throws FacilityNotExistsException, PrivilegeException Erase all the possible denials on destinations defined by the destinationName. From this moment on, there are no Services being denied on these destinations.- Parameters:
sess
-destinationName
- The name of destinations we want to clear of all the denials.- Throws:
FacilityNotExistsException
PrivilegeException
-
unblockAllServicesOnDestination
void unblockAllServicesOnDestination(PerunSession perunSession, int destinationId) throws PrivilegeException, FacilityNotExistsException, DestinationNotExistsException Erase all the possible denials on this destination. From this moment on, there are no Services being denied on this destination.- Parameters:
perunSession
-destinationId
- The id of a destination we want to clear of all the denials.- Throws:
PrivilegeException
FacilityNotExistsException
DestinationNotExistsException
-
unblockAllServicesOnFacility
void unblockAllServicesOnFacility(PerunSession perunSession, Facility facility) throws PrivilegeException Erase all the possible denials on this facility. From this moment on, there are no Services being denied on this facility.- Parameters:
perunSession
-facility
- Facility we want to clear of all the denials.- Throws:
PrivilegeException
-
unblockServiceOnDestination
void unblockServiceOnDestination(PerunSession perunSession, Service service, int destinationId) throws PrivilegeException, FacilityNotExistsException, DestinationNotExistsException Free the denial of the Service on this destination. If the Service was banned on this destination, it will be freed. In case the Service was not banned on this destination, nothing will happen.- Parameters:
perunSession
-service
- The Service, the denial of which we want to free on this destination.destinationId
- The id of a destination on which we want to free the denial of the Service.- Throws:
PrivilegeException
FacilityNotExistsException
DestinationNotExistsException
-
unblockServiceOnFacility
void unblockServiceOnFacility(PerunSession perunSession, Service service, Facility facility) throws PrivilegeException Free the denial of the Service on this facility. If the Service was banned on this facility, it will be freed. In case the Service was not banned on this facility, nothing will happen.- Parameters:
perunSession
-service
- The Service, the denial of which we want to free on this facility.facility
- The facility on which we want to free the denial of the Service.- Throws:
PrivilegeException
-
unblockServicesOnDestinations
void unblockServicesOnDestinations(PerunSession perunSession, List<RichDestination> richDestinations) throws PrivilegeException, FacilityNotExistsException, DestinationNotExistsException Free the denial of the Service on the destination - each pair defined by the rich destination. If the Service was banned on the destination, it will be freed. In case the Service was not banned on the destination, nothing will happen.- Parameters:
perunSession
-richDestinations
- the list of rich destinations- Throws:
PrivilegeException
FacilityNotExistsException
DestinationNotExistsException
-
unblockServicesOnFacility
void unblockServicesOnFacility(PerunSession sess, List<Service> services, Facility facility) throws PrivilegeException, FacilityNotExistsException, ServiceIsNotBannedException Free the denial of the services on this facility.- Parameters:
sess
- perun sessionservices
- list of servicesfacility
- facility- Throws:
PrivilegeException
- insufficient permissionsFacilityNotExistsException
- when facility does not existServiceIsNotBannedException
- when unblocking service which is not blocked
-
updateService
void updateService(PerunSession perunSession, Service service) throws ServiceNotExistsException, PrivilegeException Updates the service.- Parameters:
perunSession
-service
-- Throws:
InternalErrorException
ServiceNotExistsException
PrivilegeException
-
updateServicesPackage
void updateServicesPackage(PerunSession perunSession, ServicesPackage servicesPackage) throws ServicesPackageNotExistsException, PrivilegeException Update package- Parameters:
perunSession
-servicesPackage
- with which is the old one supposed to be updated :-)- Throws:
InternalErrorException
PrivilegeException
ServicesPackageNotExistsException
-
getFacilitiesDestinations
List all destinations for all facilities which are joined by resources to the VO.- Parameters:
sess
-vo
- vo for which we are searching destinations- Returns:
- list of destinations
- Throws:
InternalErrorException
VoNotExistsException
-
getDestinationsCount
Get count of all destinations.- Parameters:
sess
- PerunSession- Returns:
- count of all destinations
- Throws:
InternalErrorException
-