Package org.nuxeo.ecm.platform.actions
Class DefaultActionFilter
java.lang.Object
org.nuxeo.ecm.platform.actions.DefaultActionFilter
- All Implemented Interfaces:
Cloneable
,ActionFilter
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected String
static final String
protected FilterRule[]
-
Constructor Summary
ConstructorDescriptionDefaultActionFilter
(String id, FilterRule[] rules) DefaultActionFilter
(String id, FilterRule[] rules, boolean append) -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(Action action, ActionContext context) Checks whether this action is valid in the given context.protected final boolean
checkConditions
(ActionContext context, String[] conditions) Returns true if one of the conditions is verified, else false.protected final boolean
checkFacets
(ActionContext context, String[] facets) Returns true if document has one of the given facets, else false.protected final boolean
checkGroups
(ActionContext context, String[] groups) protected final boolean
checkPermissions
(ActionContext context, String[] permissions) Returns true if given document has one of the permissions, else false.protected final boolean
checkRule
(FilterRule rule, ActionContext context) Returns true if all conditions defined in the rule are true.protected final boolean
checkSchemas
(ActionContext context, String[] schemas) Returns true if document has one of the given schemas, else false.protected final boolean
checkTypes
(ActionContext context, String[] types) Returns true if document type is one of the given types, else false.clone()
Returns a clone, useful for hot reload.boolean
Equals method added to handle hot reload of inner filters, see NXP-9677boolean
getId()
getRules()
void
setAppend
(boolean append) void
void
setRules
(FilterRule[] rules)
-
Field Details
-
id
-
append
protected boolean append -
rules
-
PRECOMPUTED_KEY
- See Also:
-
-
Constructor Details
-
DefaultActionFilter
public DefaultActionFilter() -
DefaultActionFilter
-
DefaultActionFilter
-
-
Method Details
-
getId
- Specified by:
getId
in interfaceActionFilter
-
setId
- Specified by:
setId
in interfaceActionFilter
-
getRules
-
setRules
-
accept
Description copied from interface:ActionFilter
Checks whether this action is valid in the given context.The action is considered valid if no denying rule is found and at least one granting rule is found. If no rule is found at all, it is valid.
In other words: OR between granting rules, AND between denying rules, denial is favored (also if exceptions occur), AND inside of rules, OR inside or rule items (type, facet,...).
- Specified by:
accept
in interfaceActionFilter
- Parameters:
action
- the optional action to check against, should be able to be null if filters evaluation only depends on given context.context
- mandatory context holding variables to check against.- Returns:
- true if filters configuration for given action and context. Returns false if an error occurs during one of the conditions evaluation.
-
checkRule
Returns true if all conditions defined in the rule are true.Since 5.7.3, does not put computed value in context in a cache if the action context does not allow it.
- See Also:
-
checkFacets
Returns true if document has one of the given facets, else false.- Returns:
- true if document has one of the given facets, else false.
-
checkPermissions
Returns true if given document has one of the permissions, else false.If no document is found, return true only if principal is a manager.
- Returns:
- true if given document has one of the given permissions, else false
-
checkGroups
-
checkConditions
Returns true if one of the conditions is verified, else false.If one evaluation fails, return false.
- Returns:
- true if one of the conditions is verified, else false.
-
checkTypes
Returns true if document type is one of the given types, else false.If document is null, consider context is the server and return true if 'Server' is in the list.
- Returns:
- true if document type is one of the given types, else false.
-
checkSchemas
Returns true if document has one of the given schemas, else false.- Returns:
- true if document has one of the given schemas, else false
-
getAppend
public boolean getAppend() -
setAppend
public void setAppend(boolean append) -
clone
Description copied from interface:ActionFilter
Returns a clone, useful for hot reload.- Specified by:
clone
in interfaceActionFilter
- Overrides:
clone
in classObject
-
equals
Equals method added to handle hot reload of inner filters, see NXP-9677
-