Package cz.metacentrum.perun.core.api
Interface ConsentsManager
- All Known Implementing Classes:
ConsentsManagerEntry
public interface ConsentsManager
Consents entry logic.
- Author:
- Radoslav Čerhák <r.cerhak@gmail.com>
-
Method Summary
Modifier and TypeMethodDescriptionchangeConsentStatus
(PerunSession sess, Consent consent, ConsentStatus status) Set consent statusvoid
evaluateConsents
(PerunSession sess, ConsentHub consentHub) Evaluates consents for given consent hub with enforced consents enabled.void
evaluateConsents
(PerunSession sess, Service service) Evaluates consents for given service for all consent hubs with given service with enforced consents enabled.void
evaluateConsents
(PerunSession sess, List<ConsentHub> consentHubs) Evaluates consents for given list of consent hubs with enforced consents enabled.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.getConsentHubById
(PerunSession sess, int id) Finds existing Consent Hub by id.getConsentHubByName
(PerunSession sess, String name) Finds existing Consent Hub by name.getConsentHubByResource
(PerunSession sess, int resourceId) Finds existing Consent Hub for facility to which resource belongs.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 statusgetConsentsForConsentHubByResource
(PerunSession sess, int resourceId) Get consents for members assigned to the chosen resource.getConsentsForUser
(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 hubupdateConsentHub
(PerunSession perunSession, ConsentHub consentHub) Updates the consent hub.
-
Method Details
-
changeConsentStatus
Consent changeConsentStatus(PerunSession sess, Consent consent, ConsentStatus status) throws ConsentNotExistsException, PrivilegeException, InvalidConsentStatusException, UserNotExistsException Set consent status- Parameters:
sess
- perun sessionconsent
- consentstatus
- status that should be set- Returns:
- consent
- Throws:
ConsentNotExistsException
- if consent hub does not existPrivilegeException
- if insufficient rightsInvalidConsentStatusException
- if passed status value can not be setUserNotExistsException
- if user does not exist
-
evaluateConsents
Evaluates consents for given consent hub with enforced consents enabled.Service defines whether only active users will be evaluated or expired ones as well.
- Parameters:
sess
- sessionconsentHub
- consent hub- Throws:
PrivilegeException
-
evaluateConsents
Evaluates consents for given list of consent hubs with enforced consents enabled.Service defines whether only active users will be evaluated or expired ones as well.
- Parameters:
sess
- sessionconsentHubs
- consent hubs- Throws:
PrivilegeException
-
evaluateConsents
Evaluates consents for given service for all consent hubs with given service with enforced consents enabled.Corresponding consent hubs (containing the service) will have consents evaluated ONLY for selected service. 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- Throws:
PrivilegeException
-
getAllConsentHubs
Get list of all Consent Hubs- Parameters:
sess
- perun session- Returns:
- list of Consent Hubs
- Throws:
PrivilegeException
InternalErrorException
-
getAllConsents
Gel all consents- Parameters:
sess
-- Returns:
- all existing consents in the database
- Throws:
PrivilegeException
-
getConsentById
Consent getConsentById(PerunSession sess, int id) throws ConsentNotExistsException, PrivilegeException Get consent object with specified id- Parameters:
sess
-id
- id of desired consent object- Returns:
- consent object with specified id
- Throws:
ConsentNotExistsException
- thrown if consent with the id doesn't existPrivilegeException
-
getConsentForUserAndConsentHub
Consent getConsentForUserAndConsentHub(PerunSession sess, int userId, int consentHubId, ConsentStatus status) throws PrivilegeException, UserNotExistsException, ConsentHubNotExistsException, ConsentNotExistsException Get consent for chosen user in specified consent hub with specified status- Parameters:
sess
-userId
- id of the userconsentHubId
- id of the consent hubstatus
- status of the consent- Returns:
- Throws:
PrivilegeException
UserNotExistsException
ConsentHubNotExistsException
ConsentNotExistsException
-
getConsentHubByFacility
ConsentHub getConsentHubByFacility(PerunSession sess, int facilityId) throws ConsentHubNotExistsException, PrivilegeException, FacilityNotExistsException Finds existing Consent Hub by facility.- Parameters:
sess
- perun sessionfacilityId
- id of facility for which consent hub is searched- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
InternalErrorException
PrivilegeException
FacilityNotExistsException
-
getConsentHubById
ConsentHub getConsentHubById(PerunSession sess, int id) throws ConsentHubNotExistsException, PrivilegeException 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
InternalErrorException
PrivilegeException
-
getConsentHubByName
ConsentHub getConsentHubByName(PerunSession sess, String name) throws ConsentHubNotExistsException, PrivilegeException 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
InternalErrorException
PrivilegeException
-
getConsentHubByResource
ConsentHub getConsentHubByResource(PerunSession sess, int resourceId) throws ConsentHubNotExistsException, PrivilegeException, FacilityNotExistsException, ResourceNotExistsException Finds existing Consent Hub for facility to which resource belongs.- Parameters:
sess
- perun sessionresourceId
- id of resource- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
InternalErrorException
PrivilegeException
FacilityNotExistsException
ResourceNotExistsException
-
getConsentsForConsentHub
List<Consent> getConsentsForConsentHub(PerunSession sess, int id, ConsentStatus status) throws PrivilegeException, ConsentHubNotExistsException Get all consents for chosen ConsentHub with the specified status- Parameters:
sess
-id
- id of the ConsentHubstatus
- status of the consent- Returns:
- consents for chosen ConsentHub with the specified status
- Throws:
PrivilegeException
ConsentHubNotExistsException
-
getConsentsForConsentHub
List<Consent> getConsentsForConsentHub(PerunSession sess, int id) throws PrivilegeException, ConsentHubNotExistsException Get all consents for chosen ConsentHub- Parameters:
sess
-id
- id of the ConsentHub- Returns:
- consents for chosen ConsentHub
- Throws:
PrivilegeException
ConsentHubNotExistsException
-
getConsentsForConsentHubByResource
List<Consent> getConsentsForConsentHubByResource(PerunSession sess, int resourceId) throws PrivilegeException, ConsentHubNotExistsException, FacilityNotExistsException, ResourceNotExistsException Get consents for members assigned to the chosen resource.- Parameters:
sess
- sessionresourceId
- id of resource- Returns:
- consents for corresponding ConsentHub
- Throws:
PrivilegeException
ConsentHubNotExistsException
FacilityNotExistsException
ResourceNotExistsException
-
getConsentsForUser
List<Consent> getConsentsForUser(PerunSession sess, int id, ConsentStatus status) throws PrivilegeException, UserNotExistsException Get all consents for chosen User with the specified status- Parameters:
sess
-id
- id of the Userstatus
- status of the consent- Returns:
- consents for chosen User with the specified status
- Throws:
PrivilegeException
UserNotExistsException
-
getConsentsForUser
List<Consent> getConsentsForUser(PerunSession sess, int id) throws PrivilegeException, UserNotExistsException Get all consents for chosen User- Parameters:
sess
-id
- id of the user- Returns:
- consents for chosen User
- Throws:
PrivilegeException
UserNotExistsException
-
getConsentsForUserAndConsentHub
List<Consent> getConsentsForUserAndConsentHub(PerunSession sess, int userId, int consentHubId) throws PrivilegeException, UserNotExistsException, ConsentHubNotExistsException Get all consents for chosen User in specified consent hub- Parameters:
sess
-userId
- id of the userconsentHubId
- id of the consent hub- Returns:
- Throws:
PrivilegeException
UserNotExistsException
ConsentHubNotExistsException
-
updateConsentHub
ConsentHub updateConsentHub(PerunSession perunSession, ConsentHub consentHub) throws ConsentHubNotExistsException, PrivilegeException, ConsentHubExistsException Updates the consent hub. Ignores related facilities.- Parameters:
perunSession
- sessionconsentHub
- consent hub- Returns:
- updated consent hub
- Throws:
InternalErrorException
ConsentHubNotExistsException
- if consent hub does not existConsentHubExistsException
- if consent hub with the same name already existsPrivilegeException
- insufficient rights
-