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
ConstructorsConstructorDescriptionCatalogAccessPolicyContextInfoCustomizer(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.QueryInfluencercatalogAccessPolicyQueryInfluencer(@NonNull Map<String, String> consolidatedFilters) protected <T extends CatalogAccessPolicy>
Map<String,String> consolidatePolicyFilters(Collection<T> policies) voidcustomize(@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.AuthenticationUtilsprotected CatalogAccessPolicyService<CatalogAccessPolicy>protected CatalogAccessPolicyUtilsprotected com.broadleafcommerce.common.extension.data.DataRouteSupportinggetRoute()protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationServiceprotected Collection<com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.CatalogFilterRulesMapping>protected booleanshouldCustomize(@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, waitMethods 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:
customizein 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 theendpointis not one for managingCatalogAccessPoliciesas well as that the data route matches the current service. The former is done by looking for theDataRouteByExampleannotation 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
-