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 ofPermissionProvider
interface.- 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.InternetAddress
getCurrentRootUser()
Load the email address of the existing root user.java.util.List<java.lang.Class<? extends java.security.Principal>>
getSupportedPrincipals()
Getter all supportedPrincipal
s of the current eDAL system.static java.lang.InheritableThreadLocal<java.lang.String>
getThreadlocalentityid()
Getter for the fieldTHREAD_LOCAL_ENTITY_ID
.void
grantPermission(java.lang.String principalType, java.lang.String principalName, PrimaryDataEntity entity)
Grant allEdalPermission
s for onePrincipal
.void
grantPermission(java.lang.String principalType, java.lang.String principalName, EdalPermission edalPermission)
Grant oneEdalPermission
for onePrincipal
.boolean
isRoot(java.security.Principal principal)
Check if thePrincipal
is a root user.boolean
isRootValidated(javax.mail.internet.InternetAddress address)
Check if the root user is already validatedvoid
revokePermission(java.lang.String principalType, java.lang.String principalName, PrimaryDataEntity entity)
Revoke allEdalPermission
s for onePrincipal
.void
revokePermission(java.lang.String principalType, java.lang.String principalName, EdalPermission edalPermission)
Revoke oneEdalPermission
for onePrincipal
.void
setPermissionObjectID(java.lang.String id)
Set the id of the currentPrimaryDataEntity
object.void
storeRootUser(javax.security.auth.Subject subject, javax.mail.internet.InternetAddress address, java.util.UUID uuid)
Store a new root user to the back-endboolean
validateRootUser(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 grantedEdalPermission
object for aSet
ofPrincipal
objects. ASet
ofPrincipal
represent aSubject
.- Specified by:
findPermissions
in interfacePermissionProvider
- Parameters:
principalList
- aSet
ofPrincipal
objects.- Returns:
- a
List
of all grantedEdalPermission
objects.
-
grantPermission
public void grantPermission(java.lang.String principalType, java.lang.String principalName, EdalPermission edalPermission) throws PrimaryDataEntityException
Grant oneEdalPermission
for onePrincipal
.grantPermission(Principal,Method)
Check if the
Principal
or theEdalPermission
exists before grant new permission.- Specified by:
grantPermission
in interfacePermissionProvider
- Parameters:
principalType
- the type of thePrincipal
object.principalName
- the name of thePrincipal
object.edalPermission
- theEdalPermission
to 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:
grantPermission
in interfacePermissionProvider
- Parameters:
principalType
- the type of thePrincipal
object.principalName
- the name of thePrincipal
object.entity
- thePrimaryDataEntity
to grant.- Throws:
PrimaryDataEntityException
- if unable to grantEdalPermission
.
-
isRoot
public boolean isRoot(java.security.Principal principal)
Check if thePrincipal
is a root user.- Specified by:
isRoot
in interfacePermissionProvider
- Parameters:
principal
- thePrincipal
to check.- Returns:
true
when thePrincipal
is a root user;false
otherwise.
-
revokePermission
public void revokePermission(java.lang.String principalType, java.lang.String principalName, EdalPermission edalPermission) throws PrimaryDataEntityException
Revoke oneEdalPermission
for onePrincipal
.- Specified by:
revokePermission
in interfacePermissionProvider
- Parameters:
principalType
- the type of thePrincipal
object.principalName
- the name of thePrincipal
object.edalPermission
- theEdalPermission
to 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:
revokePermission
in interfacePermissionProvider
- Parameters:
principalType
- the type of thePrincipal
object.principalName
- the name of thePrincipal
object.entity
- thePrimaryDataEntity
to revoke.- Throws:
PrimaryDataEntityException
- if unable to revokeEdalPermission
.
-
setPermissionObjectID
public void setPermissionObjectID(java.lang.String id)
Set the id of the currentPrimaryDataEntity
object.- Specified by:
setPermissionObjectID
in 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 EdalException
Store a new root user to the back-end- Specified by:
storeRootUser
in interfacePermissionProvider
- Parameters:
subject
- theSubject
of the root useraddress
- the email address of the root useruuid
- theUUID
of 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:
validateRootUser
in interfacePermissionProvider
- Parameters:
address
- the email address of the root useruuid
- theUUID
of the root user- Returns:
- true if the user is valid, otherwise false
-
getCurrentRootUser
public javax.mail.internet.InternetAddress getCurrentRootUser() throws EdalException
Load the email address of the existing root user.- Specified by:
getCurrentRootUser
in 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:
isRootValidated
in 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 EdalException
Description copied from interface:PermissionProvider
Getter all supportedPrincipal
s of the current eDAL system.- Specified by:
getSupportedPrincipals
in interfacePermissionProvider
- Returns:
- the list of supported
Principal
s - Throws:
EdalException
- if unable to loadPrincipal
s.
-
-