public class CdmAuthority extends java.lang.Object implements org.springframework.security.core.GrantedAuthority, org.springframework.security.access.ConfigAttribute, IGrantedAuthorityConverter
CdmAuthority
consists basically of two parts which are separated
by a dot character '.'.
permissionClass
: an PermissionClass
instance with represents a cdm
type or a part of the cdm type hierarchy. The className is always represented
as an upper case string.property
: The CdmAuthority
only applies to instances
which satisfy the specified property. Interpretation is up to type specific voters.operation
: A string enclosed in brackets []
which specifies one Operation
or
multiple on that set of cdm types. Multiple Operation
must be comma
separated.targetUuid
: The operation
may be restricted to a specific cdm entity by adding
the entity uuid to the operation
. The uuid string is enclosed in curly brackets '{
'
, '}
' and appended to the end of the operation
.TAXONBASE.[CREATE] TAXONBASE.[READ] TAXONBASE.[UPDATE] TAXONBASE.[DELETE] DESCRIPTIONBASE.[UPDATE] DESCRIPTIONBASE.[CREATE,UPDATE,DELETE,READ] DESCRIPTIONELEMENTBASE(Ecology).[UPDATE] TAXONNODE.[UPDATE]{20c8f083-5870-4cbd-bf56-c5b2b98ab6a7}The method
#getPermissionString(String)
parses a full authority and returns permissionString and
the CdmAuthority
from the authority
.Modifier | Constructor and Description |
---|---|
|
CdmAuthority(CdmBase targetDomainObject,
java.util.EnumSet<CRUD> operation) |
|
CdmAuthority(CdmBase targetDomainObject,
java.lang.String property,
java.util.EnumSet<CRUD> operation) |
|
CdmAuthority(java.lang.Class<? extends CdmBase> targetDomainType,
java.lang.String property,
java.util.EnumSet<CRUD> operation,
java.util.UUID uuid) |
|
CdmAuthority(PermissionClass permissionClass,
java.util.EnumSet<CRUD> operation) |
|
CdmAuthority(PermissionClass permissionClass,
java.lang.String property,
java.util.EnumSet<CRUD> operation,
java.util.UUID uuid) |
protected |
CdmAuthority(java.lang.String authority) |
Modifier and Type | Method and Description |
---|---|
GrantedAuthorityImpl |
asNewGrantedAuthority() |
boolean |
equals(java.lang.Object o) |
static CdmAuthority |
fromGrantedAuthority(org.springframework.security.core.GrantedAuthority authority)
Constructs a new CdmAuthority by parsing the authority string.
|
java.lang.String |
getAttribute()
same as
toString() and getAuthority() |
java.lang.String |
getAuthority()
same as
toString() and getAttribute() |
java.util.EnumSet<CRUD> |
getOperation() |
PermissionClass |
getPermissionClass() |
java.lang.String |
getProperty() |
java.util.UUID |
getTargetUUID() |
int |
hashCode() |
boolean |
hasProperty() |
boolean |
hasTargetUuid() |
protected java.lang.String |
operationsToString() |
protected java.lang.String[] |
parse(java.lang.String authority)
Parses the given
authority and returns an array of tokens. |
void |
setOperation(java.util.EnumSet<CRUD> operation) |
java.lang.String |
toString() |
public static final Logger logger
public CdmAuthority(CdmBase targetDomainObject, java.lang.String property, java.util.EnumSet<CRUD> operation)
public CdmAuthority(java.lang.Class<? extends CdmBase> targetDomainType, java.lang.String property, java.util.EnumSet<CRUD> operation, java.util.UUID uuid)
public CdmAuthority(PermissionClass permissionClass, java.lang.String property, java.util.EnumSet<CRUD> operation, java.util.UUID uuid)
public CdmAuthority(PermissionClass permissionClass, java.util.EnumSet<CRUD> operation)
protected CdmAuthority(java.lang.String authority) throws CdmAuthorityParsingException
CdmAuthorityParsingException
public PermissionClass getPermissionClass()
public java.lang.String getProperty()
public java.util.EnumSet<CRUD> getOperation()
public void setOperation(java.util.EnumSet<CRUD> operation)
public java.util.UUID getTargetUUID()
public boolean hasTargetUuid()
public boolean hasProperty()
protected java.lang.String[] parse(java.lang.String authority) throws CdmAuthorityParsingException
authority
and returns an array of tokens.
The array has a length of four elements whereas the elements can be null.
The elements in the array correspond to the fields of CdmAuthority
:
authority
- CdmAuthorityParsingException
public java.lang.String getAuthority()
toString()
and getAttribute()
getAuthority
in interface org.springframework.security.core.GrantedAuthority
public java.lang.String getAttribute()
toString()
and getAuthority()
getAttribute
in interface org.springframework.security.access.ConfigAttribute
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected java.lang.String operationsToString()
public static CdmAuthority fromGrantedAuthority(org.springframework.security.core.GrantedAuthority authority) throws CdmAuthorityParsingException
This method is mainly used by the permission voters (CdmPermissionVoter)
.
In order to improve the voting process this method is caching the CdmAuthority
instances per GrantedAuthority
string in a map.
authority
- CdmAuthorityParsingException
public GrantedAuthorityImpl asNewGrantedAuthority() throws CdmAuthorityParsingException
asNewGrantedAuthority
in interface IGrantedAuthorityConverter
CdmAuthorityParsingException
Copyright © 2007-2020 EDIT. All Rights Reserved.