Class QuerySecurity

java.lang.Object
com.axelor.meta.query.exec.QuerySecurity
All Implemented Interfaces:
SecurityFilters

@Singleton public class QuerySecurity extends Object implements SecurityFilters
Resolves the current user's row-level read filter for a model into a JPQL predicate on a given alias, binding its parameters through the renderer's binder.

A permission's condition is written against self, the way the web client runs it: SELECT self FROM Model self WHERE condition. The predicate runs it that way too, as a subquery selecting the ids it admits, rather than renaming self to the alias in the condition's text: a rename cannot tell the row's self from one a nested subquery of the condition declares, or from the word inside a string literal.

  • Method Details

    • predicate

      public String predicate(Class<? extends Model> model, String alias, Function<Object,String> binder)
      Description copied from interface: SecurityFilters
      Returns an extra JPQL predicate restricting reads of model at alias, with any literal values bound through binder (which returns the :param placeholder), or null if the current user has no row-level filter on the model.
      Specified by:
      predicate in interface SecurityFilters