Class GenericHierarchyPolicyProcessor
java.lang.Object
ch.tocco.nice2.businessunit.impl.hierarchy.GenericHierarchyPolicyProcessor
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionGenericHierarchyPolicyProcessor
(BusinessUnitManager businessUnitManager, HierarchyStrategyProvider hierarchyStrategyProvider, SecurityManager securityManager, DataModel dataModel) -
Method Summary
Modifier and TypeMethodDescriptionvoid
processPolicy
(PolicyBuilder policy, Object target) Post-process the given policy.void
setHierarchySpecification
(List<HierarchySpecificationContribution> contributions)
-
Constructor Details
-
GenericHierarchyPolicyProcessor
public GenericHierarchyPolicyProcessor(@Lazy BusinessUnitManager businessUnitManager, HierarchyStrategyProvider hierarchyStrategyProvider, SecurityManager securityManager, DataModel dataModel)
-
-
Method Details
-
processPolicy
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 theSecurityContext
).- Specified by:
processPolicy
in interfacePolicyProcessor
-
setHierarchySpecification
@Autowired(required=false) public void setHierarchySpecification(List<HierarchySpecificationContribution> contributions)
-