Broadleaf Microservices
  • v1.0.0-latest-prod

Item List Access Rule Provider

Table of Contents

Overview

Provider for interfacing with ItemListAccessRules when operations require persistence or retrieval. The default implementation facilitates HTTP requests against the Cart Services endpoints.

Configuration

ExternalCartProperties defines the properties used to configure ExternalItemListAccessRuleProvider, which is the default provider. These include:

  • broadleaf.cartoperation.cartprovider.url: The base url for an external cart service, which handles persistence of lists as well as carts.

  • broadleaf.cartoperation.cartprovider.itemListsUri: The context path for CRUD operation on item lists. This is appended to the url property.

  • broadleaf.cartoperation.cartprovider.customersUri: The context path for retrieving access rules and roles for a specific customer. This is appended to the url property.

  • broadleaf.cartoperation.cartprovider.customersItemListAccessRulesUri: The context path for retrieving access rules specific to a customer. This is appended to the url property, a customer ID, and then the customersUri property.

  • broadleaf.cartoperation.cartprovider.customersItemListAccessRuleByRolesUri: The context path for retrieving roles specific to a customer. This is appended to the url property, a customer ID, and then the customersUri property.

  • broadleaf.cartoperation.cartprovider.itemListAccessRulesUri: The context path for managing individual ItemListAccessRules. This is appended to the url property and a list ID.

  • broadleaf.cartoperation.cartprovider.itemListAccessRulesBulkUri: The context path for bulk ItemListAccessRule operations. This is appended to the url property and a list ID.

Examples of building request from properties
// roles by customer
UriComponentsBuilder.fromHttpUrl(properties.getUrl())
        .path(properties.getCustomersUri())
        .pathSegment(customerId)
        .path(properties.getCustomersItemListAccessRuleByRolesUri())
        .queryParams(customerRefToParams(customerRef))
        .queryParam("roles", roles)
        .queryParam("listIds", itemListIds)
        .toUriString();

// single access rule management
UriComponentsBuilder.fromHttpUrl(properties.getUrl())
        .path(properties.getItemListsUri())
        .pathSegment(listId)
        .path(properties.getItemListAccessRulesUri())
        .pathSegment(ruleId)
        .toUriString();

// bulk access rule management
UriComponentsBuilder.fromHttpUrl(properties.getUrl())
        .path(properties.getItemListsUri())
        .pathSegment(listId)
        .path(properties.getItemListAccessRulesBulkUri())
        .toUriString();