@Component(value="cuba_Security") public class SecurityImpl extends java.lang.Object implements Security
| Modifier and Type | Field and Description |
|---|---|
protected ExtendedEntities |
extendedEntities |
protected Metadata |
metadata |
protected MetadataTools |
metadataTools |
protected PersistenceSecurityService |
persistenceSecurityService |
protected Scripting |
scripting |
protected UserSessionSource |
userSessionSource |
| Constructor and Description |
|---|
SecurityImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkSpecificPermission(java.lang.String name)
Check if current user has a specific permission.
|
java.lang.Object |
evaluateConstraintScript(Entity entity,
java.lang.String groovyScript) |
protected java.util.stream.Stream<AccessConstraint> |
getConstraints(MetaClass metaClass) |
boolean |
hasConstraints(MetaClass metaClass)
Check if there are registered constraints for the metaClass or it's original metaClass
|
boolean |
hasInMemoryConstraints(MetaClass metaClass,
ConstraintOperationType... operationTypes)
Check if there are registered memory constraints of specified
operationTypes for the metaClass or it's original metaClass |
boolean |
isEntityAttrPermitted(java.lang.Class<?> entityClass,
java.lang.String property,
EntityAttrAccess access)
Check if current user has permission to an entity attribute.
|
protected boolean |
isEntityAttrPermitted(MetaClass metaClass,
MetaPropertyPath propertyPath,
EntityAttrAccess access) |
boolean |
isEntityAttrPermitted(MetaClass metaClass,
java.lang.String property,
EntityAttrAccess access)
Check if current user has permission to an entity attribute.
|
boolean |
isEntityAttrReadPermitted(MetaClass metaClass,
java.lang.String propertyPath)
Check if current user can read an entity attribute which is the last part of the path given.
|
boolean |
isEntityAttrReadPermitted(MetaPropertyPath mpp)
Check if current user can read an entity attribute which is the last part of the path given.
|
boolean |
isEntityAttrUpdatePermitted(MetaClass metaClass,
java.lang.String propertyPath)
Check if current user can modify an entity attribute which is the last part of the path given.
|
boolean |
isEntityAttrUpdatePermitted(MetaPropertyPath mpp)
Check if current user can modify an entity attribute which is the last part of the path given.
|
boolean |
isEntityOpPermitted(java.lang.Class<?> entityClass,
EntityOp entityOp)
Check if current user has permission to execute an entity operation.
|
boolean |
isEntityOpPermitted(MetaClass metaClass,
EntityOp entityOp)
Check if current user has permission to execute an entity operation.
|
boolean |
isPermitted(Entity entity,
ConstraintOperationType operationType)
Check if the operation type is permitted for the entity
|
boolean |
isPermitted(Entity entity,
EntityOp operation)
Check if the operation type is permitted for the entity
|
boolean |
isPermitted(Entity entity,
java.lang.String customCode)
Check the special constraint permission for the entity
|
boolean |
isScreenPermitted(java.lang.String windowAlias)
Check if current user has permission to open a screen.
|
boolean |
isSpecificPermitted(java.lang.String name)
Check if current user has a specific permission.
|
@Inject protected UserSessionSource userSessionSource
@Inject protected Metadata metadata
@Inject protected MetadataTools metadataTools
@Inject protected ExtendedEntities extendedEntities
@Inject protected Scripting scripting
@Inject protected PersistenceSecurityService persistenceSecurityService
public boolean isScreenPermitted(java.lang.String windowAlias)
SecurityisScreenPermitted in interface SecuritywindowAlias - screen id as registered in screens.xmlpublic boolean isEntityOpPermitted(MetaClass metaClass, EntityOp entityOp)
SecurityisEntityOpPermitted in interface SecuritymetaClass - entity meta-classentityOp - operationpublic boolean isEntityOpPermitted(java.lang.Class<?> entityClass,
EntityOp entityOp)
SecurityisEntityOpPermitted in interface SecurityentityClass - entity classentityOp - operationpublic boolean isEntityAttrPermitted(MetaClass metaClass, java.lang.String property, EntityAttrAccess access)
SecurityisEntityAttrPermitted in interface SecuritymetaClass - entity meta-classproperty - entity attribute nameaccess - required accesspublic boolean isEntityAttrPermitted(java.lang.Class<?> entityClass,
java.lang.String property,
EntityAttrAccess access)
SecurityisEntityAttrPermitted in interface SecurityentityClass - entity classproperty - entity attribute nameaccess - required accesspublic boolean isEntityAttrReadPermitted(MetaClass metaClass, java.lang.String propertyPath)
SecurityEntityOp.READ on the whole entity which the attribute belongs toEntityAttrAccess.VIEW on the attributeisEntityAttrReadPermitted in interface SecuritymetaClass - entity meta classpropertyPath - entity attribute pathpublic boolean isEntityAttrUpdatePermitted(MetaClass metaClass, java.lang.String propertyPath)
SecurityEntityOp.CREATE or EntityOp.UPDATE on the whole entity which the attribute belongs toEntityAttrAccess.MODIFY on the attributeisEntityAttrUpdatePermitted in interface SecuritymetaClass - entity meta classpropertyPath - entity attribute pathpublic boolean isSpecificPermitted(java.lang.String name)
SecurityisSpecificPermitted in interface Securityname - specific permission idpublic void checkSpecificPermission(java.lang.String name)
SecuritycheckSpecificPermission in interface Securityname - specific permission idpublic boolean isEntityAttrReadPermitted(MetaPropertyPath mpp)
SecurityEntityOp.READ on the whole entity which the attribute belongs toEntityAttrAccess.VIEW on the attributeisEntityAttrReadPermitted in interface Securitympp - entity attribute pathprotected boolean isEntityAttrPermitted(MetaClass metaClass, MetaPropertyPath propertyPath, EntityAttrAccess access)
public boolean isEntityAttrUpdatePermitted(MetaPropertyPath mpp)
SecurityEntityOp.CREATE or EntityOp.UPDATE on the whole entity which the attribute belongs toEntityAttrAccess.MODIFY on the attributeisEntityAttrUpdatePermitted in interface Securitympp - entity attribute pathpublic boolean isPermitted(Entity entity, EntityOp operation)
SecurityisPermitted in interface Securitypublic boolean isPermitted(Entity entity, ConstraintOperationType operationType)
SecurityisPermitted in interface Securitypublic boolean isPermitted(Entity entity, java.lang.String customCode)
SecurityisPermitted in interface Securitypublic boolean hasConstraints(MetaClass metaClass)
SecurityhasConstraints in interface Securitypublic boolean hasInMemoryConstraints(MetaClass metaClass, ConstraintOperationType... operationTypes)
SecurityoperationTypes for the metaClass or it's original metaClasshasInMemoryConstraints in interface Securitypublic java.lang.Object evaluateConstraintScript(Entity entity, java.lang.String groovyScript)
evaluateConstraintScript in interface Securityprotected java.util.stream.Stream<AccessConstraint> getConstraints(MetaClass metaClass)