@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)
Security
isScreenPermitted
in interface Security
windowAlias
- screen id as registered in screens.xml
public boolean isEntityOpPermitted(com.haulmont.chile.core.model.MetaClass metaClass, EntityOp entityOp)
Security
isEntityOpPermitted
in interface Security
metaClass
- entity meta-classentityOp
- operationpublic boolean isEntityOpPermitted(java.lang.Class<?> entityClass, EntityOp entityOp)
Security
isEntityOpPermitted
in interface Security
entityClass
- entity classentityOp
- operationpublic boolean isEntityAttrPermitted(com.haulmont.chile.core.model.MetaClass metaClass, java.lang.String property, EntityAttrAccess access)
Security
isEntityAttrPermitted
in interface Security
metaClass
- entity meta-classproperty
- entity attribute nameaccess
- required accesspublic boolean isEntityAttrPermitted(java.lang.Class<?> entityClass, java.lang.String property, EntityAttrAccess access)
Security
isEntityAttrPermitted
in interface Security
entityClass
- entity classproperty
- entity attribute nameaccess
- required accesspublic boolean isEntityAttrReadPermitted(com.haulmont.chile.core.model.MetaClass metaClass, java.lang.String propertyPath)
Security
EntityOp.READ
on the whole entity which the attribute belongs toEntityAttrAccess.VIEW
on the attributeisEntityAttrReadPermitted
in interface Security
metaClass
- entity meta classpropertyPath
- entity attribute pathpublic boolean isEntityAttrUpdatePermitted(com.haulmont.chile.core.model.MetaClass metaClass, java.lang.String propertyPath)
Security
EntityOp.CREATE
or EntityOp.UPDATE
on the whole entity which the attribute belongs toEntityAttrAccess.MODIFY
on the attributeisEntityAttrUpdatePermitted
in interface Security
metaClass
- entity meta classpropertyPath
- entity attribute pathpublic boolean isSpecificPermitted(java.lang.String name)
Security
isSpecificPermitted
in interface Security
name
- specific permission idpublic void checkSpecificPermission(java.lang.String name)
Security
checkSpecificPermission
in interface Security
name
- specific permission idpublic boolean isEntityAttrReadPermitted(com.haulmont.chile.core.model.MetaPropertyPath mpp)
Security
EntityOp.READ
on the whole entity which the attribute belongs toEntityAttrAccess.VIEW
on the attributeisEntityAttrReadPermitted
in interface Security
mpp
- 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)
Security
EntityOp.CREATE
or EntityOp.UPDATE
on the whole entity which the attribute belongs toEntityAttrAccess.MODIFY
on the attributeisEntityAttrUpdatePermitted
in interface Security
mpp
- entity attribute pathpublic boolean isPermitted(Entity entity, ConstraintOperationType targetOperationType)
Security
isPermitted
in interface Security
public boolean isPermitted(Entity entity, java.lang.String customCode)
Security
isPermitted
in interface Security
public boolean hasConstraints(com.haulmont.chile.core.model.MetaClass metaClass)
Security
hasConstraints
in interface Security
public boolean hasInMemoryConstraints(com.haulmont.chile.core.model.MetaClass metaClass, ConstraintOperationType... operationTypes)
Security
operationTypes
for the metaClass or it's original metaClasshasInMemoryConstraints
in interface Security
protected 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 Security
protected 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)