public class PersistenceSecurityImpl extends SecurityImpl implements PersistenceSecurity
| Modifier and Type | Class and Description |
|---|---|
protected static class |
PersistenceSecurityImpl.EntityId |
| Modifier and Type | Field and Description |
|---|---|
protected AttributeSecuritySupport |
attributeSecuritySupport |
protected Configuration |
configuration |
protected EntityStates |
entityStates |
protected Persistence |
persistence |
protected ReferenceToEntitySupport |
referenceToEntitySupport |
protected SecurityTokenManager |
securityTokenManager |
extendedEntities, metadata, metadataTools, persistenceSecurityService, scripting, userSessionSourceCONSTRAINT_PARAM_SESSION_ATTR, CONSTRAINT_PARAM_USER_GROUP_ID, CONSTRAINT_PARAM_USER_ID, CONSTRAINT_PARAM_USER_LOGIN, NAME| Constructor and Description |
|---|
PersistenceSecurityImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
applyConstraints(java.util.Collection<Entity> entities)
Applies in-memory constraints to the entity fields by filtered data
|
void |
applyConstraints(Entity entity)
Applies in-memory constraints to the entity by filtered data
|
protected void |
applyConstraints(Entity entity,
java.util.Set<PersistenceSecurityImpl.EntityId> handled) |
boolean |
applyConstraints(Query query)
Modifies the query depending on current user's security constraints.
|
protected void |
assertSecurityConstraints(Entity entity,
java.util.function.BiPredicate<Entity,MetaProperty> predicate) |
void |
assertToken(Entity entity)
Validate that security token exists for specific cases.
|
protected void |
assertTokenForAttributeAccess(Entity entity) |
void |
assertTokenForREST(Entity entity,
View view)
Validate that security token for REST exists for specific cases.
|
void |
calculateFilteredData(java.util.Collection<Entity> entities)
Calculate filtered data
|
void |
calculateFilteredData(Entity entity)
Calculate filtered data
|
protected boolean |
calculateFilteredData(Entity entity,
java.util.Set<PersistenceSecurityImpl.EntityId> handled,
boolean checkPermitted) |
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.
|
boolean |
filterByConstraints(java.util.Collection<Entity> entities)
Filter entities in collection by in-memory constraints
|
boolean |
filterByConstraints(Entity entity)
Filter entity by in-memory constraints
|
boolean |
hasInMemoryReadConstraints(MetaClass metaClass)
Check if there are registered memory read constraints for the metaClass or it's original metaClass
|
protected boolean |
isNotPermittedInMemory(Entity entity) |
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
|
protected java.lang.Object |
parseValue(java.lang.Class<?> clazz,
java.lang.String string) |
protected void |
processConstraint(QueryTransformer transformer,
JpqlAccessConstraint constraint,
java.lang.String entityName) |
void |
restoreFilteredData(Entity entity)
Restores filtered data from security token
|
void |
restoreSecurityState(Entity entity)
Reads security token and restores security state
|
protected java.lang.Object |
runGroovyScript(Entity entity,
java.lang.String groovyScript) |
void |
setQueryParam(Query query,
java.lang.String paramName)
Sets the query param to a value provided by user session (see constants above).
|
ConstraintValidationResult |
validateConstraintScript(java.lang.String entityType,
java.lang.String groovyScript)
Validate groovy access constraint script
|
checkSpecificPermission, getConstraints, hasConstraints, hasInMemoryConstraints, isEntityAttrPermitted, isEntityAttrPermitted, isEntityAttrPermitted, isEntityAttrReadPermitted, isEntityAttrReadPermitted, isEntityAttrUpdatePermitted, isEntityAttrUpdatePermitted, isEntityOpPermitted, isEntityOpPermitted, isScreenPermitted, isSpecificPermittedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrestoreSecurityStateAndFilteredDatacheckSpecificPermission, hasConstraints, hasInMemoryConstraints, isEntityAttrPermitted, isEntityAttrPermitted, isEntityAttrReadPermitted, isEntityAttrReadPermitted, isEntityAttrUpdatePermitted, isEntityAttrUpdatePermitted, isEntityOpPermitted, isEntityOpPermitted, isScreenPermitted, isSpecificPermitted@Inject protected SecurityTokenManager securityTokenManager
@Inject protected Configuration configuration
@Inject protected Persistence persistence
@Inject protected ReferenceToEntitySupport referenceToEntitySupport
@Inject protected AttributeSecuritySupport attributeSecuritySupport
@Inject protected EntityStates entityStates
public boolean applyConstraints(Query query)
PersistenceSecurityapplyConstraints in interface PersistenceSecurityquery - query to modifypublic void setQueryParam(Query query, java.lang.String paramName)
PersistenceSecuritysetQueryParam in interface PersistenceSecurityquery - Query instanceparamName - parameter to setpublic boolean filterByConstraints(java.util.Collection<Entity> entities)
PersistenceSecurityfilterByConstraints in interface PersistenceSecurityentities - - collection of entities that will be filteredpublic boolean filterByConstraints(Entity entity)
PersistenceSecurityfilterByConstraints in interface PersistenceSecurityentity - - entity that will be filteredpublic void applyConstraints(java.util.Collection<Entity> entities)
PersistenceSecurityapplyConstraints in interface PersistenceSecurityentities - - collection of entitiespublic void applyConstraints(Entity entity)
PersistenceSecurityapplyConstraints in interface PersistenceSecurityentity - -public void calculateFilteredData(Entity entity)
PersistenceSecuritycalculateFilteredData in interface PersistenceSecurityentity - for which will calculate filtered datapublic void calculateFilteredData(java.util.Collection<Entity> entities)
PersistenceSecuritycalculateFilteredData in interface PersistenceSecurityentities - - collection of entities for which will calculate filtered datapublic void restoreSecurityState(Entity entity)
PersistenceSecurityrestoreSecurityState in interface PersistenceSecurityentity - - entity to restore security statepublic void restoreFilteredData(Entity entity)
PersistenceSecurityrestoreFilteredData in interface PersistenceSecurityentity - - entity to restore filtered datapublic void assertToken(Entity entity)
PersistenceSecurityassertToken in interface PersistenceSecurityentity - - entity to check security tokenpublic void assertTokenForREST(Entity entity, View view)
PersistenceSecurityassertTokenForREST in interface PersistenceSecurityentity - - entity to check security tokenview - - view for entitypublic boolean hasInMemoryReadConstraints(MetaClass metaClass)
PersistenceSecurityhasInMemoryReadConstraints in interface PersistenceSecurityprotected void assertSecurityConstraints(Entity entity, java.util.function.BiPredicate<Entity,MetaProperty> predicate)
protected void assertTokenForAttributeAccess(Entity entity)
protected void processConstraint(QueryTransformer transformer, JpqlAccessConstraint constraint, java.lang.String entityName)
protected void applyConstraints(Entity entity, java.util.Set<PersistenceSecurityImpl.EntityId> handled)
protected boolean calculateFilteredData(Entity entity, java.util.Set<PersistenceSecurityImpl.EntityId> handled, boolean checkPermitted)
public boolean isPermitted(Entity entity, EntityOp operation)
SecurityisPermitted in interface SecurityisPermitted in class SecurityImplpublic boolean isPermitted(Entity entity, ConstraintOperationType operationType)
SecurityisPermitted in interface SecurityisPermitted in class SecurityImplpublic boolean isPermitted(Entity entity, java.lang.String customCode)
SecurityisPermitted in interface SecurityisPermitted in class SecurityImplprotected boolean isNotPermittedInMemory(Entity entity)
public java.lang.Object evaluateConstraintScript(Entity entity, java.lang.String groovyScript)
evaluateConstraintScript in interface SecurityevaluateConstraintScript in class SecurityImplpublic ConstraintValidationResult validateConstraintScript(java.lang.String entityType, java.lang.String groovyScript)
PersistenceSecurityvalidateConstraintScript in interface PersistenceSecurityprotected java.lang.Object runGroovyScript(Entity entity, java.lang.String groovyScript)
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)