Class DefaultActionFilter

    • Constructor Detail

      • DefaultActionFilter

        public DefaultActionFilter()
      • DefaultActionFilter

        public DefaultActionFilter​(String id,
                                   FilterRule[] rules)
      • DefaultActionFilter

        public DefaultActionFilter​(String id,
                                   FilterRule[] rules,
                                   boolean append)
    • Method Detail

      • 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 interface ActionFilter
        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)
      • equals

        public boolean equals​(Object obj)
        Equals method added to handle hot reload of inner filters, see NXP-9677
        Overrides:
        equals in class Object
        Since:
        5.6