Interface AdminPermissionService<P extends AdminPermission>
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
- All Known Implementing Classes:
DefaultAdminPermissionService
AdminPermission
.
Supported by AdminPermissionRepository
.
Declares different versions of CRUD operations beyond just those provided by
MappableCrudEntityService
- these operations declare a ContextInfo
argument to
enable access control based upon context. In most scenarios, these operations should be preferred
to those without ContextInfo
arguments to prevent unwanted mutation/assignment in invalid
contexts.
Global permissions can be read in any context, but are immutable in all but the global context.
All other permissions can be read/modified in the global context or the tenant context the permission is assigned to. Tenant-level users can only create/modify permissions from their tenant.
Certain operations will emit an OperationAwarePersistenceMessage
to the
PersistenceProducer.TYPE
channel, which is expected to be consumed by the authentication
service and synchronized there.
- Author:
- Samarth Dhruva (samarthd)
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Creates the permission.void
Deprecated.Deletes the given permission.boolean
existsById
(String id) Deprecated.Performs an existence check to determine if there is a permission in the data store matching the given id.boolean
existsByNameAndIdNot
(String name, String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reports whether there exists a permission in the data store whoseAdminPermission.name
is equal to the givenname
and whoseAdminPermission.id
is not equal to the givenid
.org.springframework.data.domain.Page<P>
readAll
(org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads all permissions in the data store.org.springframework.data.domain.Page<P>
readAllByName
(String name, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads permissions in the data store, filtering to those whose name contains the given value.Deprecated.Reads the permission in the data store matching the given ID.readByIds
(List<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads the permissions in the data store matching the given IDs.readByIdsAndGlobal
(List<String> ids) Deprecated.Reads the permissions in the data store matching the given IDs that have anull
AdminPermission.tenantId
.replace
(String id, P permission, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Replaces the given permission.Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess
-
Method Details
-
readByIds
List<P> readByIds(List<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads the permissions in the data store matching the given IDs. If any of the permissions are not accessible from the given context as described in the class-level javadocs, they will not be returned (effectively not found).- Parameters:
ids
- the ids of the permissions to findcontextInfo
- context information about multitenant state- Returns:
- the permissions matching the given ids if found and accessible from the given context
-
readByIdsAndGlobal
Deprecated.Reads the permissions in the data store matching the given IDs that have anull
AdminPermission.tenantId
.- Parameters:
ids
- the ids of the permissions to find- Returns:
- the permissions matching the given ids that have a null
AdminPermission.tenantId
-
readAllByName
org.springframework.data.domain.Page<P> readAllByName(String name, org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads permissions in the data store, filtering to those whose name contains the given value. Results are restricted to only the permissions accessible from the given context as described in the class-level javadocs.- Parameters:
name
- the value that permission names must contain in order to matchpageable
- describes the page of results to returncontextInfo
- context information about multitenant state- Returns:
- permissions accessible in the current context that match the given name
-
readAll
org.springframework.data.domain.Page<P> readAll(org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads all permissions in the data store. Results are restricted to only the permissions accessible from the given context as described in the class-level javadocs.- Parameters:
pageable
- describes the page of results to returncontextInfo
- context information about multitenant state- Returns:
- permissions accessible in the current context
-
readById
P readById(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reads the permission in the data store matching the given ID.- Parameters:
id
- the id of the permission to findcontextInfo
- context information about multitenant state- Returns:
- the permission matching the given id if found and accessible from the given context
- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if the permission was not found or accessible from the given context
-
existsById
Deprecated.Performs an existence check to determine if there is a permission in the data store matching the given id.- Parameters:
id
- the id of the permission to find- Returns:
- true if the permission exists, false otherwise
-
existsByNameAndIdNot
boolean existsByNameAndIdNot(String name, @Nullable String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Reports whether there exists a permission in the data store whoseAdminPermission.name
is equal to the givenname
and whoseAdminPermission.id
is not equal to the givenid
. Results are restricted to only the permissions accessible from the given context as described in the class-level javadocs.- Parameters:
name
- the value that permission name must equal in order to matchid
- (optional) the value that the permission's id must not equal in order to match. If this value isnull
, then results will not be filtered by their id.contextInfo
- context information about multitenant state- Returns:
true
if there exists a permission accessible from the given context matching the given name and not matching the given id,false
otherwise
-
create
P create(P permission, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Creates the permission.If in a tenant or application context, the permission's context information will be overwritten and initialized to match the given context.
If in a global context, the permission's context information will be untouched from what is supplied.
Emits an
OperationAwarePersistenceMessage
to thePersistenceProducer.TYPE
channel.- Parameters:
permission
- the permission to createcontextInfo
- context information about multitenant state- Returns:
- the permission after it has been created in the data store
- Throws:
com.broadleafcommerce.data.tracking.core.exception.NotPermittedException
- if the current authentication cannot perform the operation (ex: the current authentication is application-restricted and therefore cannot perform this tenant-level operation)com.broadleafcommerce.common.error.validation.ValidationException
- if there were any validation errors
-
replace
P replace(String id, P permission, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Replaces the given permission.Emits an
OperationAwarePersistenceMessage
to thePersistenceProducer.TYPE
channel.- Parameters:
id
- the id of the permission to replacepermission
- the replacement permissioncontextInfo
- context information about multitenant state- Returns:
- the permission after it has been replaced in the data store
- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if the permission was not found or accessible from the given contextcom.broadleafcommerce.data.tracking.core.exception.InvalidContextRequestException
- if the permission is immutable from the given contextcom.broadleafcommerce.common.error.validation.ValidationException
- if there were validation errors
-
delete
void delete(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.Deletes the given permission.Emits an
OperationAwarePersistenceMessage
to thePersistenceProducer.TYPE
channel.- Parameters:
id
- the ID of the permission to deletecontextInfo
- context information about multitenant state- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if the permission was not found or accessible from the given contextcom.broadleafcommerce.data.tracking.core.exception.InvalidContextRequestException
- if the permission is immutable from the given contextcom.broadleafcommerce.common.error.validation.ValidationException
- if there were validation errors
-