Interface AdminPermissionService<P extends AdminPermission>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
All Known Implementing Classes:
DefaultAdminPermissionService

public interface AdminPermissionService<P extends AdminPermission> extends com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P>
Deprecated.
since 1.7.0. Roles and permissions are managed in auth.
Service API for management of 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 Type
    Method
    Description
    create(P permission, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Creates the permission.
    void
    delete(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Deletes the given permission.
    boolean
    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 whose AdminPermission.name is equal to the given name and whose AdminPermission.id is not equal to the given id.
    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.
    readById(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    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.
    Deprecated.
    Reads the permissions in the data store matching the given IDs that have a null 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 find
      contextInfo - context information about multitenant state
      Returns:
      the permissions matching the given ids if found and accessible from the given context
    • readByIdsAndGlobal

      List<P> readByIdsAndGlobal(List<String> ids)
      Deprecated.
      Reads the permissions in the data store matching the given IDs that have a null 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 match
      pageable - describes the page of results to return
      contextInfo - 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 return
      contextInfo - 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 find
      contextInfo - 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

      boolean existsById(String id)
      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 whose AdminPermission.name is equal to the given name and whose AdminPermission.id is not equal to the given id. 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 match
      id - (optional) the value that the permission's id must not equal in order to match. If this value is null, 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 the PersistenceProducer.TYPE channel.

      Parameters:
      permission - the permission to create
      contextInfo - 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 the PersistenceProducer.TYPE channel.

      Parameters:
      id - the id of the permission to replace
      permission - the replacement permission
      contextInfo - 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 context
      com.broadleafcommerce.data.tracking.core.exception.InvalidContextRequestException - if the permission is immutable from the given context
      com.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 the PersistenceProducer.TYPE channel.

      Parameters:
      id - the ID of the permission to delete
      contextInfo - context information about multitenant state
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the permission was not found or accessible from the given context
      com.broadleafcommerce.data.tracking.core.exception.InvalidContextRequestException - if the permission is immutable from the given context
      com.broadleafcommerce.common.error.validation.ValidationException - if there were validation errors