public class DefaultItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule> extends Object implements ItemListSecurityService<R>
DefaultItemListAccessRuleRole
.Constructor and Description |
---|
DefaultItemListSecurityService(com.broadleafcommerce.common.extension.TypeFactory typeFactory,
ItemListAccessRuleProvider<R> ruleProvider,
CartOperationServiceProperties properties) |
Modifier and Type | Method and Description |
---|---|
void |
assertDeleteAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Asserts that the customer can delete a given list.
|
void |
assertEditAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Asserts that the customer can edit a given list.
|
void |
assertShareAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef sharer,
@NonNull ShareItemListRequest shareRequest,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Asserts that the customer can share a given list.
|
void |
assertViewAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Asserts that the customer can view a given list.
|
protected R |
createOwnerAccessRule(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId)
Creates an owner type of access rule for the given item list.
|
protected List<R> |
createSharedAccessRules(@NonNull ShareItemListRequest shareRequest)
Creates shared access rules based off of a share request.
|
protected com.broadleafcommerce.cart.client.domain.ItemListAccessResponse |
filterAccessByRoles(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull Set<String> itemListIds,
@NonNull Set<String> roles,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Based on the provided list of
ItemList ids & roles, determines which ItemLists the
customer has access to |
com.broadleafcommerce.cart.client.domain.ItemListAccessResponse |
filterDeleteAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull Set<String> itemListIds,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Checks item list access rules for a list of item list ids based on the given customer ref and
`DELETE` access rules
|
com.broadleafcommerce.cart.client.domain.ItemListAccessResponse |
filterEditAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull Set<String> itemListIds,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Checks item list access rules for a list of item list ids based on the given customer ref and
`EDIT` access rules
|
com.broadleafcommerce.cart.client.domain.ItemListAccessResponse |
filterViewAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull Set<String> itemListIds,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Checks item list access rules for a list of item list ids based on the given customer ref and
`VIEW` access rules
|
org.springframework.data.domain.Page<R> |
getAccessibleRules(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
org.springframework.data.domain.Pageable pageable,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Gets a page of acceesible access rules for a customer.
|
protected Optional<R> |
getRule(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Gets the rule for a customer to a specific item list.
|
protected ItemListAccessRuleProvider<R> |
getRuleProvider() |
protected CartOperationServiceProperties.ItemListSecurity |
getSecurityProps() |
protected com.broadleafcommerce.common.extension.TypeFactory |
getTypeFactory() |
R |
grantOwnership(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Grants ownership of an item list to the given customer.
|
boolean |
hasDeleteAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Tells if the given customer has access to delete an item list.
|
boolean |
hasEditAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Tells if the given customer has access to edit an item list.
|
boolean |
hasShareAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull ShareItemListRequest shareRequest,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Tells if the given customer has access to share an item list.
|
boolean |
hasViewAccess(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull String itemListId,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Tells if the given customer has access to view an item list.
|
protected R |
newItemListAccessRule()
Creates a new item list access rule instance.
|
List<R> |
share(@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef sharer,
@NonNull ShareItemListRequest shareRequest,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Share an item list with other users.
|
public DefaultItemListSecurityService(com.broadleafcommerce.common.extension.TypeFactory typeFactory, ItemListAccessRuleProvider<R> ruleProvider, CartOperationServiceProperties properties)
public org.springframework.data.domain.Page<R> getAccessibleRules(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
getAccessibleRules
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the customer to find access rules forpageable
- the requested page of access rulescontext
- the context of the requestpublic R grantOwnership(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
grantOwnership
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the reference to the customer to grant ownership foritemListId
- the list to grant access tocontext
- the context of the requestpublic List<R> share(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef sharer, @NonNull @NonNull ShareItemListRequest shareRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
share
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
sharer
- the customer initiating the share requestshareRequest
- the details of the request to sharecontext
- the context of the requestpublic boolean hasViewAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
hasViewAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the reference to the customer to test access foritemListId
- the ID of the item list to test access tocontext
- the context of the requestpublic boolean hasEditAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
hasEditAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the reference to the customer to test access foritemListId
- the ID of the item list to test access tocontext
- the context of the requestpublic boolean hasDeleteAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
hasDeleteAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the reference to the customer to test access foritemListId
- the ID of the item list to test access tocontext
- the context of the requestpublic boolean hasShareAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull ShareItemListRequest shareRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
hasShareAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the reference to the customer to test access forshareRequest
- the request that describes how and which item list should be sharedcontext
- the context of the requestpublic com.broadleafcommerce.cart.client.domain.ItemListAccessResponse filterViewAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull Set<String> itemListIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
filterViewAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the reference to the customer to test access foritemListIds
- the list of item list ids to checkcontext
- the context of the requestpublic com.broadleafcommerce.cart.client.domain.ItemListAccessResponse filterEditAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull Set<String> itemListIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
filterEditAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the reference to the customer to test access foritemListIds
- the list of item list ids to checkcontext
- the context of the requestpublic com.broadleafcommerce.cart.client.domain.ItemListAccessResponse filterDeleteAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull Set<String> itemListIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
filterDeleteAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the reference to the customer to test access foritemListIds
- the list of item list ids to checkcontext
- the context of the requestpublic void assertViewAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
assertViewAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the customer reference to test access foritemListId
- the ID of the item list to test access tocontext
- the context of the requestpublic void assertEditAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
assertEditAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the customer reference to test access foritemListId
- the ID of the item list to test access tocontext
- the context of the requestpublic void assertDeleteAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
assertDeleteAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
customerRef
- the customer reference to test access foritemListId
- the ID of the item list to test access tocontext
- the context of the requestpublic void assertShareAccess(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef sharer, @NonNull @NonNull ShareItemListRequest shareRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListSecurityService
assertShareAccess
in interface ItemListSecurityService<R extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
sharer
- the customer reference to test access forshareRequest
- the request to share the item listcontext
- the context of the requestprotected R createOwnerAccessRule(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId)
customerRef
- the reference to the (new) owning customeritemListId
- the item list ID to grant access toprotected List<R> createSharedAccessRules(@NonNull @NonNull ShareItemListRequest shareRequest)
shareRequest
- the share request to create backing access rules forprotected Optional<R> getRule(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
customerRef
- a reference ot the customer to find an access rule foritemListId
- the ID of the item list to get an access rule forcontext
- the context of the requestprotected R newItemListAccessRule()
protected com.broadleafcommerce.cart.client.domain.ItemListAccessResponse filterAccessByRoles(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull Set<String> itemListIds, @NonNull @NonNull Set<String> roles, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemList
ids & roles, determines which ItemLists the
customer has access tocustomerRef
- the customer to check access foritemListIds
- the list of item list ids to checkroles
- the access roles we want to verifycontext
- the context of the requestprotected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
protected ItemListAccessRuleProvider<R> getRuleProvider()
protected CartOperationServiceProperties.ItemListSecurity getSecurityProps()
Copyright © 2021. All rights reserved.