Class CatalogAccessPolicyContextInfoCustomizer
java.lang.Object
com.broadleafcommerce.catalog.service.context.CatalogAccessPolicyContextInfoCustomizer
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.context.ContextInfoCustomizer
,org.springframework.core.Ordered
public class CatalogAccessPolicyContextInfoCustomizer
extends Object
implements com.broadleafcommerce.data.tracking.core.context.ContextInfoCustomizer
Responsible for adding filters from
CatalogAccessPolicies
that apply
to the current context.- Author:
- Nathan Moore (nathandmoore)
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionCatalogAccessPolicyContextInfoCustomizer
(com.broadleafcommerce.common.extension.data.DataRouteSupporting route, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, CatalogAccessPolicyService<CatalogAccessPolicy> catalogAccessPolicyService, Collection<com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.CatalogFilterRulesMapping> ruleMappings, com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService ruleEvaluationService, CatalogAccessPolicyUtils catalogAccessPolicyUtils) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfo.QueryInfluencer
catalogAccessPolicyQueryInfluencer
(@NonNull Map<String, String> consolidatedFilters) protected <T extends CatalogAccessPolicy>
Map<String,String> consolidatePolicyFilters
(Collection<T> policies) void
customize
(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, String routeKey, org.springframework.core.MethodParameter endpoint, org.springframework.web.context.request.NativeWebRequest webRequest) protected <T extends CatalogAccessPolicy>
StringcustomizeRule
(String rule, String entity, T policy) Extension hook point allowing additional run-time customization to the configured rule.protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils
protected CatalogAccessPolicyService<CatalogAccessPolicy>
protected CatalogAccessPolicyUtils
protected com.broadleafcommerce.common.extension.data.DataRouteSupporting
getRoute()
protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService
protected Collection<com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.CatalogFilterRulesMapping>
protected boolean
shouldCustomize
(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, String routeKey, org.springframework.core.MethodParameter endpoint, org.springframework.web.context.request.NativeWebRequest webRequest) Whether the customizer should process the request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.context.ContextInfoCustomizer
getOrder
-
Constructor Details
-
CatalogAccessPolicyContextInfoCustomizer
public CatalogAccessPolicyContextInfoCustomizer(com.broadleafcommerce.common.extension.data.DataRouteSupporting route, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils, CatalogAccessPolicyService<CatalogAccessPolicy> catalogAccessPolicyService, Collection<com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.CatalogFilterRulesMapping> ruleMappings, com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService ruleEvaluationService, CatalogAccessPolicyUtils catalogAccessPolicyUtils)
-
-
Method Details
-
customize
public void customize(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @Nullable String routeKey, @Nullable org.springframework.core.MethodParameter endpoint, @Nullable org.springframework.web.context.request.NativeWebRequest webRequest) - Specified by:
customize
in interfacecom.broadleafcommerce.data.tracking.core.context.ContextInfoCustomizer
-
shouldCustomize
protected boolean shouldCustomize(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @Nullable String routeKey, @Nullable org.springframework.core.MethodParameter endpoint, @Nullable org.springframework.web.context.request.NativeWebRequest webRequest) Whether the customizer should process the request. This will check that theendpoint
is not one for managingCatalogAccessPolicies
as well as that the data route matches the current service. The former is done by looking for theDataRouteByExample
annotation on the endpoint's class as there isn't another reliable way to do this.- Parameters:
contextInfo
- The instance to customizerouteKey
- Analogous to the key identified byDataRouteByKey
.endpoint
- The method that initiated the instantiation of this ContextInfo instance.webRequest
- Web call related information.- Returns:
- Whether the customizer should process the request.
-
consolidatePolicyFilters
protected <T extends CatalogAccessPolicy> Map<String,String> consolidatePolicyFilters(Collection<T> policies) -
customizeRule
protected <T extends CatalogAccessPolicy> String customizeRule(String rule, String entity, T policy) Extension hook point allowing additional run-time customization to the configured rule.- Type Parameters:
T
- - object of type CatalogAccessPolicy- Parameters:
rule
- - The filter ruleentity
- - The entity targetpolicy
- - the policy this rule is a part of- Returns:
- - the modified rule (if applicable)
-
catalogAccessPolicyQueryInfluencer
-
getRoute
protected com.broadleafcommerce.common.extension.data.DataRouteSupporting getRoute() -
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils() -
getCatalogAccessPolicyService
-
getRuleMappings
protected Collection<com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.CatalogFilterRulesMapping> getRuleMappings() -
getRuleEvaluationService
protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService getRuleEvaluationService() -
getCatalogAccessPolicyUtils
-