Class PermissionProviderImplementation
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.file.implementation.PermissionProviderImplementation
-
- All Implemented Interfaces:
PermissionProvider,java.io.Serializable
public class PermissionProviderImplementation extends java.lang.Object implements java.io.Serializable, PermissionProvider
Implementation ofPermissionProviderinterface.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PermissionProviderImplementation()
-
Method Summary
Modifier and Type Method Description java.util.List<EdalPermission>findPermissions(java.util.Set<java.security.Principal> principalList)javax.mail.internet.InternetAddressgetCurrentRootUser()Load the email address of the existing root user.java.util.List<java.lang.Class<? extends java.security.Principal>>getSupportedPrincipals()Getter all supportedPrincipals of the current eDAL system.static java.lang.InheritableThreadLocal<java.lang.String>getThreadlocalentityid()Getter for the fieldTHREAD_LOCAL_ENTITY_ID.voidgrantPermission(java.lang.String principalType, java.lang.String principalName, PrimaryDataEntity entity)Grant allEdalPermissions for onePrincipal.voidgrantPermission(java.lang.String principalType, java.lang.String principalName, EdalPermission edalPermission)Grant oneEdalPermissionfor onePrincipal.booleanisRoot(java.security.Principal principal)Check if thePrincipalis a root user.booleanisRootValidated(javax.mail.internet.InternetAddress address)Check if the root user is already validatedvoidrevokePermission(java.lang.String principalType, java.lang.String principalName, PrimaryDataEntity entity)Revoke allEdalPermissions for onePrincipal.voidrevokePermission(java.lang.String principalType, java.lang.String principalName, EdalPermission edalPermission)Revoke oneEdalPermissionfor onePrincipal.voidsetPermissionObjectID(java.lang.String id)Set the id of the currentPrimaryDataEntityobject.voidstoreRootUser(javax.security.auth.Subject subject, javax.mail.internet.InternetAddress address, java.util.UUID uuid)Store a new root user to the back-endbooleanvalidateRootUser(javax.mail.internet.InternetAddress address, java.util.UUID uuid)Validate the root user with the given email address andUUID
-
-
-
Method Detail
-
getThreadlocalentityid
public static java.lang.InheritableThreadLocal<java.lang.String> getThreadlocalentityid()
Getter for the fieldTHREAD_LOCAL_ENTITY_ID.- Returns:
- the THREAD_LOCAL_ENTITY_ID
-
findPermissions
public java.util.List<EdalPermission> findPermissions(java.util.Set<java.security.Principal> principalList)
Provides all grantedEdalPermissionobject for aSetofPrincipalobjects. ASetofPrincipalrepresent aSubject.- Specified by:
findPermissionsin interfacePermissionProvider- Parameters:
principalList- aSetofPrincipalobjects.- Returns:
- a
Listof all grantedEdalPermissionobjects.
-
grantPermission
public void grantPermission(java.lang.String principalType, java.lang.String principalName, EdalPermission edalPermission) throws PrimaryDataEntityExceptionGrant oneEdalPermissionfor onePrincipal.grantPermission(Principal,Method)
Check if the
Principalor theEdalPermissionexists before grant new permission.- Specified by:
grantPermissionin interfacePermissionProvider- Parameters:
principalType- the type of thePrincipalobject.principalName- the name of thePrincipalobject.edalPermission- theEdalPermissionto grant.- Throws:
PrimaryDataEntityException- if unable to grantEdalPermission.
-
grantPermission
public void grantPermission(java.lang.String principalType, java.lang.String principalName, PrimaryDataEntity entity) throws PrimaryDataEntityException- Specified by:
grantPermissionin interfacePermissionProvider- Parameters:
principalType- the type of thePrincipalobject.principalName- the name of thePrincipalobject.entity- thePrimaryDataEntityto grant.- Throws:
PrimaryDataEntityException- if unable to grantEdalPermission.
-
isRoot
public boolean isRoot(java.security.Principal principal)
Check if thePrincipalis a root user.- Specified by:
isRootin interfacePermissionProvider- Parameters:
principal- thePrincipalto check.- Returns:
truewhen thePrincipalis a root user;falseotherwise.
-
revokePermission
public void revokePermission(java.lang.String principalType, java.lang.String principalName, EdalPermission edalPermission) throws PrimaryDataEntityExceptionRevoke oneEdalPermissionfor onePrincipal.- Specified by:
revokePermissionin interfacePermissionProvider- Parameters:
principalType- the type of thePrincipalobject.principalName- the name of thePrincipalobject.edalPermission- theEdalPermissionto revoke.- Throws:
PrimaryDataEntityException- if unable to revokeEdalPermission.
-
revokePermission
public void revokePermission(java.lang.String principalType, java.lang.String principalName, PrimaryDataEntity entity) throws PrimaryDataEntityException- Specified by:
revokePermissionin interfacePermissionProvider- Parameters:
principalType- the type of thePrincipalobject.principalName- the name of thePrincipalobject.entity- thePrimaryDataEntityto revoke.- Throws:
PrimaryDataEntityException- if unable to revokeEdalPermission.
-
setPermissionObjectID
public void setPermissionObjectID(java.lang.String id)
Set the id of the currentPrimaryDataEntityobject.- Specified by:
setPermissionObjectIDin interfacePermissionProvider- Parameters:
id- the id to set.
-
storeRootUser
public void storeRootUser(javax.security.auth.Subject subject, javax.mail.internet.InternetAddress address, java.util.UUID uuid) throws EdalExceptionStore a new root user to the back-end- Specified by:
storeRootUserin interfacePermissionProvider- Parameters:
subject- theSubjectof the root useraddress- the email address of the root useruuid- theUUIDof the root user- Throws:
EdalException- if unable to store
-
validateRootUser
public boolean validateRootUser(javax.mail.internet.InternetAddress address, java.util.UUID uuid)Validate the root user with the given email address andUUID- Specified by:
validateRootUserin interfacePermissionProvider- Parameters:
address- the email address of the root useruuid- theUUIDof the root user- Returns:
- true if the user is valid, otherwise false
-
getCurrentRootUser
public javax.mail.internet.InternetAddress getCurrentRootUser() throws EdalExceptionLoad the email address of the existing root user.- Specified by:
getCurrentRootUserin interfacePermissionProvider- Returns:
- the email address.
- Throws:
EdalException- If unable to load existing root user.
-
isRootValidated
public boolean isRootValidated(javax.mail.internet.InternetAddress address)
Check if the root user is already validated- Specified by:
isRootValidatedin interfacePermissionProvider- Parameters:
address- the email address of the root user- Returns:
- yes if the root user is already validated; no if not
-
getSupportedPrincipals
public java.util.List<java.lang.Class<? extends java.security.Principal>> getSupportedPrincipals() throws EdalExceptionDescription copied from interface:PermissionProviderGetter all supportedPrincipals of the current eDAL system.- Specified by:
getSupportedPrincipalsin interfacePermissionProvider- Returns:
- the list of supported
Principals - Throws:
EdalException- if unable to loadPrincipals.
-
-