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)
  • 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 interface com.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 the endpoint is not one for managing CatalogAccessPolicies as well as that the data route matches the current service. The former is done by looking for the DataRouteByExample annotation on the endpoint's class as there isn't another reliable way to do this.
      Parameters:
      contextInfo - The instance to customize
      routeKey - Analogous to the key identified by DataRouteByKey.
      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 rule
      entity - - The entity target
      policy - - the policy this rule is a part of
      Returns:
      - the modified rule (if applicable)
    • catalogAccessPolicyQueryInfluencer

      protected com.broadleafcommerce.data.tracking.core.context.ContextInfo.QueryInfluencer catalogAccessPolicyQueryInfluencer(@NonNull @NonNull Map<String,String> consolidatedFilters)
    • getRoute

      protected com.broadleafcommerce.common.extension.data.DataRouteSupporting getRoute()
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
    • getCatalogAccessPolicyService

      protected CatalogAccessPolicyService<CatalogAccessPolicy> getCatalogAccessPolicyService()
    • getRuleMappings

      protected Collection<com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.CatalogFilterRulesMapping> getRuleMappings()
    • getRuleEvaluationService

      protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService getRuleEvaluationService()
    • getCatalogAccessPolicyUtils

      protected CatalogAccessPolicyUtils getCatalogAccessPolicyUtils()