public class DefaultActionFilter extends Object implements ActionFilter, Cloneable
Modifier and Type | Field and Description |
---|---|
protected boolean |
append |
protected String |
id |
static String |
PRECOMPUTED_KEY |
protected FilterRule[] |
rules |
Constructor and Description |
---|
DefaultActionFilter() |
DefaultActionFilter(String id,
FilterRule[] rules) |
DefaultActionFilter(String id,
FilterRule[] rules,
boolean append) |
Modifier and Type | Method and 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-9677
|
boolean |
getAppend() |
String |
getId() |
FilterRule[] |
getRules() |
void |
setAppend(boolean append) |
void |
setId(String id) |
void |
setRules(FilterRule[] rules) |
protected boolean append
protected FilterRule[] rules
public static final String PRECOMPUTED_KEY
public DefaultActionFilter()
public DefaultActionFilter(String id, FilterRule[] rules)
public DefaultActionFilter(String id, FilterRule[] rules, boolean append)
public String getId()
getId
in interface ActionFilter
public void setId(String id)
setId
in interface ActionFilter
public FilterRule[] getRules()
public void setRules(FilterRule[] rules)
public boolean accept(Action action, ActionContext context)
ActionFilter
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,...).
accept
in interface ActionFilter
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.protected final boolean checkRule(FilterRule rule, ActionContext context)
Since 5.7.3, does not put computed value in context in a cache if the action context does not allow it.
ActionContext.disableGlobalCaching()
protected final boolean checkFacets(ActionContext context, String[] facets)
protected final boolean checkPermissions(ActionContext context, String[] permissions)
If no document is found, return true only if principal is a manager.
protected final boolean checkGroups(ActionContext context, String[] groups)
protected final boolean checkConditions(ActionContext context, String[] conditions)
If one evaluation fails, return false.
protected final boolean checkTypes(ActionContext context, String[] types)
If document is null, consider context is the server and return true if 'Server' is in the list.
protected final boolean checkSchemas(ActionContext context, String[] schemas)
public boolean getAppend()
public void setAppend(boolean append)
public DefaultActionFilter clone()
ActionFilter
clone
in interface ActionFilter
clone
in class Object
Copyright © 2015 Nuxeo SA. All rights reserved.