Class AbstractEntityRuleProvider

java.lang.Object
ch.tocco.nice2.rest.entity.api.ruleprovider.AbstractEntityRuleProvider
All Implemented Interfaces:
RuleProvider
Direct Known Subclasses:
OwnTimetableRuleProvider, PresenceCheckRuleProvider

public abstract class AbstractEntityRuleProvider extends Object implements RuleProvider
  • Constructor Details

  • Method Details

    • createRulesForRequest

      public final void createRulesForRequest(Principal principal, PolicyBuilder policyBuilder)
      Specified by:
      createRulesForRequest in interface RuleProvider
    • rulesForRequest

      @VisibleForTesting public void rulesForRequest(Principal principal, PolicyBuilder policyBuilder)
      Implement specific rules for this rule provider.
    • allowReportingAccess

      protected boolean allowReportingAccess()
      Per default access to the entities used for generating reports is granted. However this can be disabled here
    • grantFullReadAccess

      protected void grantFullReadAccess(PolicyBuilder policyBuilder, String model)
      Helper method to grant full (= all paths) read to all entities of a model.
    • grantActionAccess

      protected void grantActionAccess(PolicyBuilder policyBuilder, String... actionIds)
    • grantCreateAccess

      protected void grantCreateAccess(PolicyBuilder policyBuilder, String... models)
    • grantEntityReadAccess

      protected void grantEntityReadAccess(PolicyBuilder policyBuilder, String model, Condition condition)
      Helper method to grant read access to entities of a model which match the condition. Paths which are not whitelisted via contribution are not readable.
    • grantEntityWriteAccess

      protected void grantEntityWriteAccess(PolicyBuilder policyBuilder, String model, Condition condition)
      Helper method to grant write access to entities of a model which match the condition. Paths which are not whitelisted via contribution are not readable.
    • grantEntityWriteAccessForPaths

      protected void grantEntityWriteAccessForPaths(PolicyBuilder policyBuilder, String model, Condition condition, String... paths)
      Helper method to grant write access for specific paths for entities of a model which match the condition.
    • loadRelatedKeys

      protected List<PrimaryKey> loadRelatedKeys(String targetModel, String relation, List<PrimaryKey> sourceKeys)
      Helper method which returns the primary keys of the related source keys
    • getKeyCondition

      protected Condition getKeyCondition(String relation, List<PrimaryKey> keys)
      Helper method which returns the key condition for a relation
    • grantReportingAccess

      @VisibleForTesting protected void grantReportingAccess(PolicyBuilder policyBuilder)
    • setRuleProviderContributions

      @Autowired public void setRuleProviderContributions(List<RuleProviderContribution> contributions)