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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected List<TypePermissionConfigs>buildAllIncludedAttributes(List<TypePermissionConfigs> configurations) Returns a list of type permission configs by building theIncludeattribute that contains the list of attributes to be included for each type during permission checking.Initializes the service with Configuration containing type and attribute level permissions for each type.protected voidbuildIncludedAttributesForType(TypePermissionConfigs typeConfig) Builds theIncludeattribute that contains the list of attributes to be included for the type during permission checking.Initializes the service with Configuration containing type and attribute level permissions for each type.getAllSubTypesPermissionConfigs(Map<String, List<String>> configurations) Returns configurations for all subtypes for each type in the povided configurations list.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.protected booleanprotected booleanprotected Optional<AttributePermissionForType>getPermissionConfigByTypeCode(String typeCode) Returns a list of attribute permission types available for a given type code.protected List<AttributePermissionForType>protected List<AttributePermissionForType>getPermissionConfigsByTypeCodes(List<String> typeCodes) Returns a list of attribute permission types available for each provided type code.protected TypePermissionConfigsgetPermissionConfigsForType(AttributePermissionForType permissionConfig) Returns all permission configs for a given type represented by theAttributePermissionForType.protected TypeServiceinitializeCompiledAttributeConfigurations(Long expirationTime) initializeCompiledTypeConfigurations(Long expirationTime) booleanisAttributeVerifiable(String typeCode, String attribute) Method that tests whether the provided attribute part of theComposedTypeModelfor the giventypeCodecan be verified while permission checking.booleanisTypeVerifiable(String typeCode) Method that tests whether theComposedTypeModelfor the giventypeCodecan be verified while permission checking.parseParam(String params) Parses the given parameter that contains a comma separated attributes and returns a list.voidsetCheckingAllAttributes(boolean checkingAllAttributes) voidsetCheckingAllTypes(boolean checkingAllTypes) voidsetPermissionConfigs(List<AttributePermissionForType> permissionConfigs) voidsetTypeService(TypeService typeService)
-
Field Details
-
DEFAULT_EXPIRATION_TIME
-
-
Constructor Details
-
DefaultPermissionEnablerService
public DefaultPermissionEnablerService()
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
initializeCompiledTypeConfigurations
-
initializeCompiledAttributeConfigurations
-
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 theAttributePermissionForType.- 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 theIncludeattribute 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
Builds theIncludeattribute that contains the list of attributes to be included for the type during permission checking.- Parameters:
typeConfig- The type permission configuration
-
parseParam
Parses the given parameter that contains a comma separated attributes and returns a list. -
getPermissionConfigsByTypeCodes
Returns a list of attribute permission types available for each provided type code. -
getPermissionConfigByTypeCode
Returns a list of attribute permission types available for a given type code. -
isTypeVerifiable
Description copied from interface:PermissionEnablerServiceMethod that tests whether theComposedTypeModelfor the giventypeCodecan be verified while permission checking.- Specified by:
isTypeVerifiablein interfacePermissionEnablerService- Parameters:
typeCode- The type code to be verified.- Returns:
TRUEif the permission checking is enabled for the given type,FALSEotherwise.
-
isAttributeVerifiable
Description copied from interface:PermissionEnablerServiceMethod that tests whether the provided attribute part of theComposedTypeModelfor the giventypeCodecan be verified while permission checking. This method also checks if the attribute is in all the super types of the given type.- Specified by:
isAttributeVerifiablein interfacePermissionEnablerService- Parameters:
typeCode- The type code to of the attribute to be verified.attribute- The attribute to be verified.- Returns:
TRUEif the permission checking is enabled for the given attribute within a type,FALSEotherwise.
-
getPermissionConfigs
-
setPermissionConfigs
-
getTypeService
-
setTypeService
-
getCheckingAllTypes
protected boolean getCheckingAllTypes() -
setCheckingAllTypes
public void setCheckingAllTypes(boolean checkingAllTypes) -
getCheckingAllAttributes
protected boolean getCheckingAllAttributes() -
setCheckingAllAttributes
public void setCheckingAllAttributes(boolean checkingAllAttributes)
-