Class AbstractEntityRuleProvider
java.lang.Object
ch.tocco.nice2.rest.entity.api.ruleprovider.AbstractEntityRuleProvider
- All Implemented Interfaces:
RuleProvider
- Direct Known Subclasses:
FunctionMutationRuleProvider, JobApplicationRuleProvider, MembershipAdministrationRuleProvider, MembershipRegistrationRuleProvider, MembershipSearchRuleProvider, OwnTimetableRuleProvider, PresenceCheckRuleProvider, ReservationLecturerBookingConfirmationRuleProvider, ReservationLecturerBookingViewRuleProvider, WageViewRuleProvider
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEntityRuleProvider(TypeManager typeManager, DataModel dataModel, FormModel formModel, QueryBuilderFactory queryBuilderFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanPer default access to some entities used by the widget config is granted.protected booleanPer default access to the entities used for generating reports is granted.final voidcreateRulesForRequest(Principal principal, @Nullable String widgetKey, PolicyBuilder policyBuilder) protected voiddenyEntityReadAccessForPaths(PolicyBuilder policyBuilder, String model, Condition condition, String... paths) Helper method to deny read access for specific paths for entities of a model which match the condition.protected voiddenyEntityWriteAccessForPaths(PolicyBuilder policyBuilder, String model, Condition condition, String... paths) Helper method to deny write access for specific paths for entities of a model which match the condition.protected ConditiongetKeyCondition(String relation, Collection<PrimaryKey> keys) Helper method which returns the key condition for a relationprotected voidgrantActionAccess(PolicyBuilder policyBuilder, String... actionIds) protected voidgrantCreateAccess(PolicyBuilder policyBuilder, String... models) protected voidgrantEntityDeleteAccess(PolicyBuilder policyBuilder, String model, Condition condition) Helper method to grant delete access to entities of a model which match the condition.protected voidgrantEntityReadAccess(PolicyBuilder policyBuilder, String model, Condition condition) Helper method to grant read access to entities of a model which match the condition.protected voidgrantEntityReadAccessForPaths(PolicyBuilder policyBuilder, String model, Condition condition, String... paths) Helper method to grant read access for specific paths for entities of a model which match the condition.protected voidgrantEntityWriteAccess(PolicyBuilder policyBuilder, String model, Condition condition) Helper method to grant write access to entities of a model which match the condition.protected voidgrantEntityWriteAccessForPaths(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.protected voidgrantFullReadAccess(PolicyBuilder policyBuilder, String model) Helper method to grant full (= all paths) read to all entities of a model.protected voidgrantReportingAccess(PolicyBuilder policyBuilder) protected List<PrimaryKey> loadRelatedKeys(String targetModel, String relation, List<PrimaryKey> sourceKeys) Helper method which returns the primary keys of the related source keysvoidrulesForRequest(Principal principal, @Nullable String widgetKey, PolicyBuilder policyBuilder) Implement specific rules for this rule provider.voidsetRuleProviderContributions(List<RuleProviderContribution> contributions) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RuleProvider
getId
-
Field Details
-
queryBuilderFactory
-
-
Constructor Details
-
AbstractEntityRuleProvider
public AbstractEntityRuleProvider(TypeManager typeManager, DataModel dataModel, FormModel formModel, QueryBuilderFactory queryBuilderFactory)
-
-
Method Details
-
createRulesForRequest
public final void createRulesForRequest(Principal principal, @Nullable @Nullable String widgetKey, PolicyBuilder policyBuilder) - Specified by:
createRulesForRequestin interfaceRuleProvider
-
rulesForRequest
@VisibleForTesting public void rulesForRequest(Principal principal, @Nullable @Nullable String widgetKey, PolicyBuilder policyBuilder) Implement specific rules for this rule provider. -
allowDefaultAccess
protected boolean allowDefaultAccess()Per default access to some entities used by the widget config is granted. However this can be disabled here -
allowReportingAccess
protected boolean allowReportingAccess()Per default access to the entities used for generating reports is granted. However this can be disabled here -
grantFullReadAccess
Helper method to grant full (= all paths) read to all entities of a model. -
grantActionAccess
-
grantCreateAccess
-
grantEntityDeleteAccess
protected void grantEntityDeleteAccess(PolicyBuilder policyBuilder, String model, Condition condition) Helper method to grant delete access to entities of a model which match the condition. -
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. -
grantEntityReadAccessForPaths
protected void grantEntityReadAccessForPaths(PolicyBuilder policyBuilder, String model, Condition condition, String... paths) Helper method to grant read access for specific paths for entities of a model which match the condition. -
denyEntityWriteAccessForPaths
protected void denyEntityWriteAccessForPaths(PolicyBuilder policyBuilder, String model, Condition condition, String... paths) Helper method to deny write access for specific paths for entities of a model which match the condition. -
denyEntityReadAccessForPaths
protected void denyEntityReadAccessForPaths(PolicyBuilder policyBuilder, String model, Condition condition, String... paths) Helper method to deny read 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
Helper method which returns the key condition for a relation -
grantReportingAccess
-
setRuleProviderContributions
-