Package org.nuxeo.ecm.platform.actions
Class DefaultActionFilter
- java.lang.Object
-
- org.nuxeo.ecm.platform.actions.DefaultActionFilter
-
- All Implemented Interfaces:
Cloneable
,ActionFilter
public class DefaultActionFilter extends Object implements ActionFilter, Cloneable
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
append
protected String
id
static String
PRECOMPUTED_KEY
protected FilterRule[]
rules
-
Constructor Summary
Constructors Constructor Description DefaultActionFilter()
DefaultActionFilter(String id, FilterRule[] rules)
DefaultActionFilter(String id, FilterRule[] rules, boolean append)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Action action, ActionContext context)
Checks whether this action is valid in the given context.protected boolean
checkConditions(ActionContext context, String[] conditions)
Returns true if one of the conditions is verified, else false.protected boolean
checkFacets(ActionContext context, String[] facets)
Returns true if document has one of the given facets, else false.protected boolean
checkGroups(ActionContext context, String[] groups)
protected boolean
checkPermissions(ActionContext context, String[] permissions)
Returns true if given document has one of the permissions, else false.protected boolean
checkRule(FilterRule rule, ActionContext context)
Returns true if all conditions defined in the rule are true.protected boolean
checkSchemas(ActionContext context, String[] schemas)
Returns true if document has one of the given schemas, else false.protected boolean
checkTypes(ActionContext context, String[] types)
Returns true if document type is one of the given types, else false.DefaultActionFilter
clone()
Returns a clone, useful for hot reload.boolean
equals(Object obj)
Equals method added to handle hot reload of inner filters, see NXP-9677boolean
getAppend()
String
getId()
FilterRule[]
getRules()
void
setAppend(boolean append)
void
setId(String id)
void
setRules(FilterRule[] rules)
-
-
-
Field Detail
-
id
protected String id
-
append
protected boolean append
-
rules
protected FilterRule[] rules
-
PRECOMPUTED_KEY
public static final String PRECOMPUTED_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultActionFilter
public DefaultActionFilter()
-
DefaultActionFilter
public DefaultActionFilter(String id, FilterRule[] rules)
-
DefaultActionFilter
public DefaultActionFilter(String id, FilterRule[] rules, boolean append)
-
-
Method Detail
-
getId
public String getId()
- Specified by:
getId
in interfaceActionFilter
-
setId
public void setId(String id)
- Specified by:
setId
in interfaceActionFilter
-
getRules
public FilterRule[] getRules()
-
setRules
public void setRules(FilterRule[] rules)
-
accept
public boolean accept(Action action, ActionContext context)
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
protected final boolean checkRule(FilterRule rule, ActionContext context)
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:
ActionContext.disableGlobalCaching()
-
checkFacets
protected final boolean checkFacets(ActionContext context, String[] facets)
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
protected final boolean checkPermissions(ActionContext context, String[] permissions)
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
protected final boolean checkGroups(ActionContext context, String[] groups)
-
checkConditions
protected final boolean checkConditions(ActionContext context, String[] conditions)
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
protected final boolean checkTypes(ActionContext context, String[] types)
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
protected final boolean checkSchemas(ActionContext context, String[] schemas)
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
public DefaultActionFilter clone()
Description copied from interface:ActionFilter
Returns a clone, useful for hot reload.- Specified by:
clone
in interfaceActionFilter
- Overrides:
clone
in classObject
-
-