Interface AdminRoleService<P extends AdminRole>

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

@Deprecated public interface AdminRoleService<P extends AdminRole> 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 AdminRole.

Supported by AdminRoleRepository.

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 roles can be read in any context, but are immutable in all but the global context.

All other roles can be read/modified in the global context or the tenant context the role is assigned to. Tenant-level users can only create/modify roles 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 role, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Creates the role.
    void
    Deprecated.
    Perform a delete operation on the entity identified by the id.
    void
    delete(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Deletes the given role.
    boolean
    Deprecated.
    Performs an existence check to determine if there is a role in the data store matching the given id.
    boolean
    existsById(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Performs an existence check to determine if there is a role in the data store matching the given ID.
    boolean
    Deprecated.
    Performs an existence check to determine if there is a role in the data store matching the given ID that has a null AdminRole.tenantId.
    boolean
    existsByNameAndIdNot(String name, String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Reports whether there exists a role in the data store whose AdminRole.name is equal to the given name and whose AdminRole.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 roles 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 roles 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 role in the data store matching the given ID.
    Deprecated.
    Read a single role by id.
    readByIds(List<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Reads the roles in the data store matching the given IDs.
    replace(String id, P role, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated.
    Replaces the given role.

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService

    create, createAll, createAllAllowingPartialSuccess, readAll, readAll, readAll, readAllByIds, readById, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess
  • Method Details

    • readByIdOptional

      Optional<P> readByIdOptional(@NonNull String id)
      Deprecated.
      Read a single role by id.

      Similar to MappableCrudEntityService.readById(String), but does not throw an exception if the entity is not found.

      Parameters:
      id - the id of the role to find
      Returns:
      an Optional containing the role if found, otherwise Optional.empty()
    • readByIds

      List<P> readByIds(List<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Reads the roles in the data store matching the given IDs. If any of the roles 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 roles to find
      contextInfo - context information about multitenant state
      Returns:
      the roles matching the given ids if found and accessible from the given context
    • 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 roles in the data store, filtering to those whose name contains the given value. Results are restricted to only the roles accessible from the given context as described in the class-level javadocs.
      Parameters:
      name - the value that role names must contain in order to match
      pageable - describes the page of results to return
      contextInfo - context information about multitenant state
      Returns:
      roles accessible in the current context that match the given name
    • existsByNameAndIdNot

      boolean existsByNameAndIdNot(String name, @Nullable String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Reports whether there exists a role in the data store whose AdminRole.name is equal to the given name and whose AdminRole.id is not equal to the given id. Results are restricted to only the roles accessible from the given context as described in the class-level javadocs.
      Parameters:
      name - the value that role name must equal in order to match
      id - (optional) the value that the role'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 role accessible from the given context matching the given name and not matching the given id, false otherwise
    • 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 roles in the data store. Results are restricted to only the roles 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:
      roles accessible in the current context
    • readById

      P readById(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Reads the role in the data store matching the given ID.
      Parameters:
      id - the id of the role to find
      contextInfo - context information about multitenant state
      Returns:
      the role matching the given id if found and accessible from the given context
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the role 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 role in the data store matching the given id.
      Parameters:
      id - the id of the role to find
      Returns:
      true if the role exists, false otherwise
    • existsByIdInGlobal

      boolean existsByIdInGlobal(String id)
      Deprecated.
      Performs an existence check to determine if there is a role in the data store matching the given ID that has a null AdminRole.tenantId.
      Parameters:
      id - the id of the role to find
      Returns:
      true if the role exists and has a null AdminRole.tenantId, false otherwise
    • existsById

      boolean existsById(String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Performs an existence check to determine if there is a role in the data store matching the given ID.

      Result will only be true if the record is also accessible from the given context as described in the class-level javadocs.

      Parameters:
      id - the id of the role to find
      contextInfo - context information about multitenant state
      Returns:
      true if a role exists that matches the given id and is accessible from the given context
    • create

      P create(P role, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Creates the role.

      If in a tenant or application context, the role's context information will be overwritten and initialized to match the given context.

      If in a global context, the role's context information will be untouched from what is supplied.

      Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

      Parameters:
      role - the role to create
      contextInfo - context information about multitenant state
      Returns:
      the role 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 role, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated.
      Replaces the given role.

      Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

      Parameters:
      id - the id of the role to replace
      role - the replacement role
      contextInfo - context information about multitenant state
      Returns:
      the role after it has been replaced in the data store
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the role was not found or accessible from the given context
      com.broadleafcommerce.data.tracking.core.exception.InvalidContextRequestException - if the role 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 role.

      Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

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

      void delete(String id)
      Deprecated.
      Perform a delete operation on the entity identified by the id.

      Emits an OperationAwarePersistenceMessage to the PersistenceProducer.TYPE channel.

      Specified by:
      delete in interface com.broadleafcommerce.data.tracking.core.service.MappableCrudEntityService<P extends AdminRole>
      Parameters:
      id - The id for the entity.
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if no instance was found in the backing store corresponding to id
      InvalidAdminRoleDeleteException - if the role has children