Interface ConsentsManagerBl
- All Known Implementing Classes:
ConsentsManagerBlImpl
- Author:
- Radoslav Čerhák invalid input: '<'r.cerhak@gmail.com>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFacility
(PerunSession sess, ConsentHub consentHub, Facility facility) Adds facility to consent hub.changeConsentStatus
(PerunSession sess, Consent consent, ConsentStatus status) Set consent statusvoid
checkConsentExists
(PerunSession sess, Consent consent) Check if consent exists in underlying data source.void
checkConsentHubExists
(PerunSession sess, ConsentHub consentHub) Throws exception if consent hub does not exist.boolean
consentHubExists
(PerunSession sess, ConsentHub consentHub) Returns true, if consent hub exists, false otherwise.createConsent
(PerunSession perunSession, Consent consent) Creates a new consent with status 'UNSIGNED'.createConsentHub
(PerunSession perunSession, ConsentHub consentHub) Creates new consent hub.void
deleteConsent
(PerunSession sess, Consent consent) Deletes consentvoid
deleteConsentHub
(PerunSession perunSession, ConsentHub consentHub) Deletes consent hub.void
evaluateConsents
(PerunSession sess, ConsentHub consentHub) Evaluates consents for given consent hub with enforced consents enabled.void
evaluateConsents
(PerunSession sess, Service service) Consolidate consents using given service on consent hubs the service is assigned to.evaluateConsents
(PerunSession sess, Service service, Facility facility, List<Member> members) This method runs in a new transaction!! Because it is used by getData methods which run in read-only serializable transactions.evaluateConsents
(PerunSession sess, Service service, Facility facility, List<Member> members, boolean consentEval) This method runs in a new transaction!! Because it is used by getData methods which run in read-only serializable transactions.Get list of all Consent HubsgetAllConsents
(PerunSession sess) Gel all consentsgetConsentById
(PerunSession sess, int id) Get consent object with specified idgetConsentForUserAndConsentHub
(PerunSession sess, int userId, int consentHubId, ConsentStatus status) Get consent for chosen user in specified consent hub with specified statusgetConsentHubByFacility
(PerunSession sess, int facilityId) Finds existing Consent Hub by facility id.getConsentHubById
(PerunSession sess, int id) Finds existing Consent Hub by id.getConsentHubByName
(PerunSession sess, String name) Finds existing Consent Hub by name.getConsentHubsByService
(PerunSession sess, int serviceId) Finds all existing Consent Hubs by service id (consent hubs that have given service assigned through facilities).getConsentsForConsentHub
(PerunSession sess, int id) Get all consents for chosen ConsentHubgetConsentsForConsentHub
(PerunSession sess, int id, ConsentStatus status) Get all consents for chosen ConsentHub with the specified statusgetConsentsForUser
(PerunSession sess, int id) Get all consents for chosen UsergetConsentsForUser
(PerunSession sess, int id, ConsentStatus status) Get all consents for chosen User with the specified statusgetConsentsForUserAndConsentHub
(PerunSession sess, int userId, int consentHubId) Get all consents for chosen user in specified consent hubvoid
removeFacility
(PerunSession sess, ConsentHub consentHub, Facility facility) Removes facility from consent hub.updateConsentHub
(PerunSession perunSession, ConsentHub consentHub) Updates the ConsentHub.
-
Method Details
-
addFacility
void addFacility(PerunSession sess, ConsentHub consentHub, Facility facility) throws FacilityAlreadyAssigned Adds facility to consent hub.- Parameters:
sess
- sessionconsentHub
- consent hubfacility
- facility to be added- Throws:
FacilityAlreadyAssigned
- if facility is already assigned to consent hub
-
changeConsentStatus
Consent changeConsentStatus(PerunSession sess, Consent consent, ConsentStatus status) throws InvalidConsentStatusException Set consent status- Parameters:
sess
- perun sessionconsent
- consent- Returns:
- consent
- Throws:
InvalidConsentStatusException
- if passed status value can not be set
-
checkConsentExists
Check if consent exists in underlying data source.- Parameters:
sess
- PerunSessionconsent
- Consent to check- Throws:
ConsentNotExistsException
- if consent doesn't exist
-
checkConsentHubExists
void checkConsentHubExists(PerunSession sess, ConsentHub consentHub) throws ConsentHubNotExistsException Throws exception if consent hub does not exist.- Parameters:
sess
- sessionconsentHub
- consent hub- Throws:
ConsentHubNotExistsException
- if consent hub does not exist
-
consentHubExists
Returns true, if consent hub exists, false otherwise.- Parameters:
sess
- sessionconsentHub
- consent hub- Returns:
- whether consent hub exists
-
createConsent
Consent createConsent(PerunSession perunSession, Consent consent) throws ConsentExistsException, ConsentHubNotExistsException, UserNotExistsException Creates a new consent with status 'UNSIGNED'. Consent's attributes are computed based on the attributes of the user and the consent hub. Attributes in the consent are ignored!If the user has already 'UNSIGNED' consent for the same consent hub, that consent is deleted and replaced with the new one.
- Parameters:
perunSession
- perun sessionconsent
- Consent to create- Returns:
- created consent
- Throws:
ConsentExistsException
- if consent already existsConsentHubNotExistsException
- if consent hub doesn't existUserNotExistsException
- if a user with consent's userId doesn't exist
-
createConsentHub
ConsentHub createConsentHub(PerunSession perunSession, ConsentHub consentHub) throws ConsentHubExistsException Creates new consent hub.- Parameters:
perunSession
- sessionconsentHub
- consent hub- Returns:
- new consent hub
- Throws:
ConsentHubExistsException
- if consent hub with similar name exists
-
deleteConsent
Deletes consent- Parameters:
sess
- perun sessionconsent
- consent to delete- Throws:
ConsentNotExistsException
- if consent doesn't exist
-
deleteConsentHub
void deleteConsentHub(PerunSession perunSession, ConsentHub consentHub) throws ConsentHubAlreadyRemovedException Deletes consent hub.- Parameters:
perunSession
- sessionconsentHub
- consent hub- Throws:
ConsentHubAlreadyRemovedException
- if no such consent hub stored in db
-
evaluateConsents
List<Member> evaluateConsents(PerunSession sess, Service service, Facility facility, List<Member> members) This method runs in a new transaction!! Because it is used by getData methods which run in read-only serializable transactions.Returns members from the given members list that have a valid consent for the propagation of the service required attributes to the facility.
Users must have a consent for the facility's consent hub with status GRANTED and it contains all the required attributes.
If the user has no consent in any status that contains all the required attributes, a new UNSIGNED consent is created for the user.
If the consent logic is turned off on the instance (property forceConsents) or the facility's consent hub doesn't enforce consents, all members are returned and no unsigned consents for users are created.
- Parameters:
sess
- perun sessionservice
- the servicefacility
- the facilitymembers
- the given members
-
evaluateConsents
List<Member> evaluateConsents(PerunSession sess, Service service, Facility facility, List<Member> members, boolean consentEval) This method runs in a new transaction!! Because it is used by getData methods which run in read-only serializable transactions.Returns members from the given members list that have a valid consent for the propagation of the service required attributes to the facility.
Users must have a consent for the facility's consent hub with status GRANTED and it contains all the required attributes.
If the user has no consent in any status that contains all the required attributes, a new UNSIGNED consent is created for the user.
If the consent logic is turned off on the instance (property forceConsents) or the facility's consent hub doesn't enforce consents, all members are returned and no unsigned consents for users are created.
If the consent evaluation is turned off (in CLI without the -c option), the members with UNSIGNED consent creation is skipped.
- Parameters:
sess
- perun sessionservice
- the servicefacility
- the facilitymembers
- the given membersconsentEval
- if the consent evaluation should be performed
-
evaluateConsents
Evaluates consents for given consent hub with enforced consents enabled.For given ConsentHub, collects all attributes from services assigned to it and compares it against attributes from users' Consent objects that are assigned to resources of given ConsentHub object.
Service defines whether only active users will be evaluated or expired ones as well.
- Parameters:
sess
- sessionconsentHub
- consent hub
-
evaluateConsents
Consolidate consents using given service on consent hubs the service is assigned to.Method finds all consent hubs that contain given service in any of its facilities and start consent consolidation for each consent hub (only selected service in consent hubs will be checked). Service defines whether only active users will be evaluated or expired ones as well. If new consent is created, attributes from ALL services under given consent hub are gathered for it.
- Parameters:
sess
- sessionservice
- service
-
getAllConsentHubs
Get list of all Consent Hubs- Parameters:
sess
- perun session- Returns:
- list of Consent Hubs
- Throws:
InternalErrorException
- if an exception occurred
-
getAllConsents
Gel all consents- Parameters:
sess
- perun session- Returns:
- all existing consents in the database
-
getConsentById
Get consent object with specified id- Parameters:
sess
- perun sessionid
- id of desired consent object- Returns:
- consent object with specified id
- Throws:
ConsentNotExistsException
- thrown if consent with the id doesn't exist
-
getConsentForUserAndConsentHub
Consent getConsentForUserAndConsentHub(PerunSession sess, int userId, int consentHubId, ConsentStatus status) throws ConsentNotExistsException Get consent for chosen user in specified consent hub with specified status- Parameters:
sess
- perun sessionuserId
- if of the userconsentHubId
- id of the consent hubstatus
- specified status- Returns:
- consent
- Throws:
ConsentNotExistsException
- thrown if consent with the id doesn't exist
-
getConsentHubByFacility
ConsentHub getConsentHubByFacility(PerunSession sess, int facilityId) throws ConsentHubNotExistsException Finds existing Consent Hub by facility id.- Parameters:
sess
- perun sessionfacilityId
- facility for which consent hub is searched- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
- if Consent Hub doesn't exist
-
getConsentHubById
Finds existing Consent Hub by id.- Parameters:
sess
- perun sessionid
- id of the Consent Hub you are looking for- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
- if Consent Hub doesn't existInternalErrorException
- if an exception occurred
-
getConsentHubByName
Finds existing Consent Hub by name.- Parameters:
sess
- perun sessionname
- name of the Consent Hub you are looking for- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
- if Consent Hub doesn't existInternalErrorException
- if an exception occurred
-
getConsentHubsByService
List<ConsentHub> getConsentHubsByService(PerunSession sess, int serviceId) throws ConsentHubNotExistsException Finds all existing Consent Hubs by service id (consent hubs that have given service assigned through facilities).- Parameters:
sess
- perun sessionserviceId
- service for which consent hubs is searched- Returns:
- found Consent Hubs
- Throws:
ConsentHubNotExistsException
- if Consent Hub doesn't exist
-
getConsentsForConsentHub
Get all consents for chosen ConsentHub with the specified status- Parameters:
sess
- perun sessionid
- id of the ConsentHubstatus
- status of the consent- Returns:
- consents for chosen ConsentHub with the specified status
-
getConsentsForConsentHub
Get all consents for chosen ConsentHub- Parameters:
sess
- perun sessionid
- id of the ConsentHub- Returns:
- consents for chosen ConsentHub
-
getConsentsForUser
Get all consents for chosen User with the specified status- Parameters:
sess
- perun sessionid
- id of the Userstatus
- status of the consent- Returns:
- consents for chosen User with the specified status
-
getConsentsForUser
Get all consents for chosen User- Parameters:
sess
- perun sessionid
- id of the user- Returns:
- consents for chosen User
-
getConsentsForUserAndConsentHub
Get all consents for chosen user in specified consent hub- Parameters:
sess
- perun sessionuserId
- id of the userconsentHubId
- id of the consent hub- Returns:
- consents
-
removeFacility
void removeFacility(PerunSession sess, ConsentHub consentHub, Facility facility) throws RelationNotExistsException, ConsentHubAlreadyRemovedException Removes facility from consent hub. If it was the last facility on consent hub, deletes consent hub too.- Parameters:
sess
- sessionconsentHub
- consent hubfacility
- facility to be removed- Throws:
RelationNotExistsException
- if facility is not assigned to consent hubConsentHubAlreadyRemovedException
- if the last facility was removed and deletion of consent hub failed
-
updateConsentHub
ConsentHub updateConsentHub(PerunSession perunSession, ConsentHub consentHub) throws ConsentHubExistsException Updates the ConsentHub. Ignores related facilities.- Parameters:
perunSession
- sessionconsentHub
- consentHub- Returns:
- updated consent hub
- Throws:
ConsentHubExistsException
- if consent hub with the same name exists
-