Class DefaultPermissionEnablerService

java.lang.Object
de.hybris.platform.cms2.permissions.impl.DefaultPermissionEnablerService
All Implemented Interfaces:
PermissionEnablerService, org.springframework.beans.factory.InitializingBean

public class DefaultPermissionEnablerService extends Object implements PermissionEnablerService, org.springframework.beans.factory.InitializingBean
Implementation of PermissionEnablerService that tunes type and attribute permission checking.
  • Field Details

    • DEFAULT_EXPIRATION_TIME

      protected static final Long DEFAULT_EXPIRATION_TIME
  • Constructor Details

    • DefaultPermissionEnablerService

      public DefaultPermissionEnablerService()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • initializeCompiledTypeConfigurations

      protected com.google.common.base.Supplier<Map<String,List<String>>> initializeCompiledTypeConfigurations(Long expirationTime)
    • initializeCompiledAttributeConfigurations

      protected com.google.common.base.Supplier<Map<String,List<String>>> initializeCompiledAttributeConfigurations(Long expirationTime)
    • buildTypeConfigurations

      protected com.google.common.base.Supplier<Map<String,List<String>>> buildTypeConfigurations()
      Initializes the service with Configuration containing type and attribute level permissions for each type.
    • buildAttributeConfigurationsForAllTypes

      protected com.google.common.base.Supplier<Map<String,List<String>>> buildAttributeConfigurationsForAllTypes()
      Initializes the service with Configuration containing type and attribute level permissions for each type.
    • getAllSubTypesPermissionConfigs

      protected Map<String,List<String>> getAllSubTypesPermissionConfigs(Map<String,List<String>> configurations)
      Returns configurations for all subtypes for each type in the povided configurations list.
      Parameters:
      configurations - The list of type configurations.
      Returns:
      The list of all subtype configurations for each type.
    • getAllTypePermissionConfigs

      protected List<TypePermissionConfigs> getAllTypePermissionConfigs(List<AttributePermissionForType> permissionConfigs)
      Returns a list of type permission configs where each config is a collection of attribute permission configs for each type and its super types.
      Parameters:
      permissionConfigs - List of attribute permission configs for type
      Returns:
      The list of type permission configs
    • getPermissionConfigsForType

      protected TypePermissionConfigs getPermissionConfigsForType(AttributePermissionForType permissionConfig)
      Returns all permission configs for a given type represented by the AttributePermissionForType.
      Parameters:
      permissionConfig - Attribute permission configuration for a type
      Returns:
      The type permission configurations
    • buildAllIncludedAttributes

      protected List<TypePermissionConfigs> buildAllIncludedAttributes(List<TypePermissionConfigs> configurations)
      Returns a list of type permission configs by building the Include attribute that contains the list of attributes to be included for each type during permission checking.
      Parameters:
      configurations - The list of type permission configs
      Returns:
      The list of type permission configs with include attributes populated.
    • buildIncludedAttributesForType

      protected void buildIncludedAttributesForType(TypePermissionConfigs typeConfig)
      Builds the Include attribute that contains the list of attributes to be included for the type during permission checking.
      Parameters:
      typeConfig - The type permission configuration
    • parseParam

      protected List<String> parseParam(String params)
      Parses the given parameter that contains a comma separated attributes and returns a list.
    • getPermissionConfigsByTypeCodes

      protected List<AttributePermissionForType> getPermissionConfigsByTypeCodes(List<String> typeCodes)
      Returns a list of attribute permission types available for each provided type code.
    • getPermissionConfigByTypeCode

      protected Optional<AttributePermissionForType> getPermissionConfigByTypeCode(String typeCode)
      Returns a list of attribute permission types available for a given type code.
    • isTypeVerifiable

      public boolean isTypeVerifiable(String typeCode)
      Description copied from interface: PermissionEnablerService
      Method that tests whether the ComposedTypeModel for the given typeCode can be verified while permission checking.
      Specified by:
      isTypeVerifiable in interface PermissionEnablerService
      Parameters:
      typeCode - The type code to be verified.
      Returns:
      TRUE if the permission checking is enabled for the given type, FALSE otherwise.
    • isAttributeVerifiable

      public boolean isAttributeVerifiable(String typeCode, String attribute)
      Description copied from interface: PermissionEnablerService
      Method that tests whether the provided attribute part of the ComposedTypeModel for the given typeCode can be verified while permission checking. This method also checks if the attribute is in all the super types of the given type.
      Specified by:
      isAttributeVerifiable in interface PermissionEnablerService
      Parameters:
      typeCode - The type code to of the attribute to be verified.
      attribute - The attribute to be verified.
      Returns:
      TRUE if the permission checking is enabled for the given attribute within a type, FALSE otherwise.
    • getPermissionConfigs

      protected List<AttributePermissionForType> getPermissionConfigs()
    • setPermissionConfigs

      public void setPermissionConfigs(List<AttributePermissionForType> permissionConfigs)
    • getTypeService

      protected TypeService getTypeService()
    • setTypeService

      public void setTypeService(TypeService typeService)
    • getCheckingAllTypes

      protected boolean getCheckingAllTypes()
    • setCheckingAllTypes

      public void setCheckingAllTypes(boolean checkingAllTypes)
    • getCheckingAllAttributes

      protected boolean getCheckingAllAttributes()
    • setCheckingAllAttributes

      public void setCheckingAllAttributes(boolean checkingAllAttributes)