@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 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 void |
fillGroovyConstraintsContext(java.util.Map<java.lang.String,java.lang.Object> context)
Override if you need specific context variables in Groovy constraints.
|
protected java.util.List<ConstraintData> |
getConstraints(com.haulmont.chile.core.model.MetaClass metaClass) |
protected java.util.List<ConstraintData> |
getConstraints(com.haulmont.chile.core.model.MetaClass metaClass,
java.util.function.Predicate<ConstraintData> predicate) |
boolean |
hasConstraints(com.haulmont.chile.core.model.MetaClass metaClass)
Check if there are registered constraints for the metaClass or it's original metaClass
|
boolean |
hasInMemoryConstraints(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.MetaClass metaClass,
com.haulmont.chile.core.model.MetaPropertyPath propertyPath,
EntityAttrAccess access) |
boolean |
isEntityAttrPermitted(com.haulmont.chile.core.model.MetaClass metaClass,
java.lang.String property,
EntityAttrAccess access)
Check if current user has permission to an entity attribute.
|
boolean |
isEntityAttrReadPermitted(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.MetaPropertyPath mpp)
Check if current user can read an entity attribute which is the last part of the path given.
|
boolean |
isEntityAttrUpdatePermitted(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.MetaClass metaClass,
EntityOp entityOp)
Check if current user has permission to execute an entity operation.
|
protected boolean |
isPermitted(Entity entity,
ConstraintData constraint) |
boolean |
isPermitted(Entity entity,
ConstraintOperationType targetOperationType)
Check if the operation type is permitted for the entity
|
protected boolean |
isPermitted(Entity entity,
java.util.function.Predicate<ConstraintData> predicate) |
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.
|
protected java.lang.Object |
parseValue(java.lang.Class<?> clazz,
java.lang.String string) |
@Inject protected UserSessionSource userSessionSource
@Inject protected Metadata metadata
@Inject protected MetadataTools metadataTools
@Inject protected ExtendedEntities extendedEntities
@Inject protected Scripting scripting
public boolean isScreenPermitted(java.lang.String windowAlias)
SecurityisScreenPermitted in interface SecuritywindowAlias - screen id as registered in screens.xmlpublic boolean isEntityOpPermitted(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.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(com.haulmont.chile.core.model.MetaClass metaClass,
com.haulmont.chile.core.model.MetaPropertyPath propertyPath,
EntityAttrAccess access)
public boolean isEntityAttrUpdatePermitted(com.haulmont.chile.core.model.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, ConstraintOperationType targetOperationType)
SecurityisPermitted in interface Securitypublic boolean isPermitted(Entity entity, java.lang.String customCode)
SecurityisPermitted in interface Securitypublic boolean hasConstraints(com.haulmont.chile.core.model.MetaClass metaClass)
SecurityhasConstraints in interface Securitypublic boolean hasInMemoryConstraints(com.haulmont.chile.core.model.MetaClass metaClass,
ConstraintOperationType... operationTypes)
SecurityoperationTypes for the metaClass or it's original metaClasshasInMemoryConstraints in interface Securityprotected java.util.List<ConstraintData> getConstraints(com.haulmont.chile.core.model.MetaClass metaClass, java.util.function.Predicate<ConstraintData> predicate)
protected java.util.List<ConstraintData> getConstraints(com.haulmont.chile.core.model.MetaClass metaClass)
protected boolean isPermitted(Entity entity, java.util.function.Predicate<ConstraintData> predicate)
protected boolean isPermitted(Entity entity, ConstraintData constraint)
public java.lang.Object evaluateConstraintScript(Entity entity, java.lang.String groovyScript)
evaluateConstraintScript in interface Securityprotected void fillGroovyConstraintsContext(java.util.Map<java.lang.String,java.lang.Object> context)
context - passed to Groovy evaluatorprotected java.lang.Object parseValue(java.lang.Class<?> clazz,
java.lang.String string)