Class GenericHierarchyPolicyProcessor

java.lang.Object
ch.tocco.nice2.businessunit.impl.hierarchy.GenericHierarchyPolicyProcessor
All Implemented Interfaces:
PolicyProcessor

@Component public class GenericHierarchyPolicyProcessor extends Object implements PolicyProcessor
A generic policy processor to handle the write access for hierarchical business unit structures. To add a strategy to a specific entity model a manually created relation to the business unit must exist. Additionally the hierarchy strategy must be contributed for the entity model. Example of a contribution which defines a hierarchical business unit strategy for the User entity:

 @Bean
 public HierarchySpecificationContribution xyHierarchySpecificationContribution() {
     HierarchySpecificationContribution hierarchySpecification = new HierarchySpecificationContribution();
     hierarchySpecification.setEntityModel("User");
     hierarchySpecification.setReadAccess("hierarchical");
     hierarchySpecification.setWriteAccess("hierarchical");
     hierarchySpecification.setBusinessUnitRelation("relBusiness_unit_hierarchy");
     return hierarchySpecification;
 }
 
This policy processor can handle different types of strategies for different models. strategies: - HIERARCHICAL - SELF - ALL See HierarchyStrategyType for more information about the different strategies.
  • Constructor Details

  • Method Details

    • processPolicy

      public void processPolicy(PolicyBuilder policy, Object target)
      Description copied from interface: PolicyProcessor
      Post-process the given policy. On phase `LOGIN`, the `target` is the principal being logged in, on phase `GUARD`, it's the object being guarded. On phase `LOGIN` the `policy` is the entire policy containing all rules that affect the current user, on phase `GUARD` the policy only contains the rules that are relevant to the guarded objects (the entire policy, if needed, can be retrieved from the SecurityContext).
      Specified by:
      processPolicy in interface PolicyProcessor
    • setHierarchySpecification

      @Autowired(required=false) public void setHierarchySpecification(List<HierarchySpecificationContribution> contributions)