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 java.lang.Object implements PermissionEnablerService, org.springframework.beans.factory.InitializingBean
Implementation ofPermissionEnablerServicethat tunes type and attribute permission checking.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.LongDEFAULT_EXPIRATION_TIME
-
Constructor Summary
Constructors Constructor Description DefaultPermissionEnablerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected java.util.List<TypePermissionConfigs>buildAllIncludedAttributes(java.util.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.protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>>buildAttributeConfigurationsForAllTypes()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.protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>>buildTypeConfigurations()Initializes the service with Configuration containing type and attribute level permissions for each type.protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>getAllSubTypesPermissionConfigs(java.util.Map<java.lang.String,java.util.List<java.lang.String>> configurations)Returns configurations for all subtypes for each type in the povided configurations list.protected java.util.List<TypePermissionConfigs>getAllTypePermissionConfigs(java.util.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 booleangetCheckingAllAttributes()protected booleangetCheckingAllTypes()protected java.util.Optional<AttributePermissionForType>getPermissionConfigByTypeCode(java.lang.String typeCode)Returns a list of attribute permission types available for a given type code.protected java.util.List<AttributePermissionForType>getPermissionConfigs()protected java.util.List<AttributePermissionForType>getPermissionConfigsByTypeCodes(java.util.List<java.lang.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 TypeServicegetTypeService()protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>>initializeCompiledAttributeConfigurations(java.lang.Long expirationTime)protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>>initializeCompiledTypeConfigurations(java.lang.Long expirationTime)booleanisAttributeVerifiable(java.lang.String typeCode, java.lang.String attribute)Method that tests whether the provided attribute part of theComposedTypeModelfor the giventypeCodecan be verified while permission checking.booleanisTypeVerifiable(java.lang.String typeCode)Method that tests whether theComposedTypeModelfor the giventypeCodecan be verified while permission checking.protected java.util.List<java.lang.String>parseParam(java.lang.String params)Parses the given parameter that contains a comma separated attributes and returns a list.voidsetCheckingAllAttributes(boolean checkingAllAttributes)voidsetCheckingAllTypes(boolean checkingAllTypes)voidsetPermissionConfigs(java.util.List<AttributePermissionForType> permissionConfigs)voidsetTypeService(TypeService typeService)
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
initializeCompiledTypeConfigurations
protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>> initializeCompiledTypeConfigurations(java.lang.Long expirationTime)
-
initializeCompiledAttributeConfigurations
protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>> initializeCompiledAttributeConfigurations(java.lang.Long expirationTime)
-
buildTypeConfigurations
protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>> buildTypeConfigurations()
Initializes the service with Configuration containing type and attribute level permissions for each type.
-
buildAttributeConfigurationsForAllTypes
protected com.google.common.base.Supplier<java.util.Map<java.lang.String,java.util.List<java.lang.String>>> buildAttributeConfigurationsForAllTypes()
Initializes the service with Configuration containing type and attribute level permissions for each type.
-
getAllSubTypesPermissionConfigs
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllSubTypesPermissionConfigs(java.util.Map<java.lang.String,java.util.List<java.lang.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 java.util.List<TypePermissionConfigs> getAllTypePermissionConfigs(java.util.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 java.util.List<TypePermissionConfigs> buildAllIncludedAttributes(java.util.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
protected void buildIncludedAttributesForType(TypePermissionConfigs typeConfig)
Builds theIncludeattribute that contains the list of attributes to be included for the type during permission checking.- Parameters:
typeConfig- The type permission configuration
-
parseParam
protected java.util.List<java.lang.String> parseParam(java.lang.String params)
Parses the given parameter that contains a comma separated attributes and returns a list.
-
getPermissionConfigsByTypeCodes
protected java.util.List<AttributePermissionForType> getPermissionConfigsByTypeCodes(java.util.List<java.lang.String> typeCodes)
Returns a list of attribute permission types available for each provided type code.
-
getPermissionConfigByTypeCode
protected java.util.Optional<AttributePermissionForType> getPermissionConfigByTypeCode(java.lang.String typeCode)
Returns a list of attribute permission types available for a given type code.
-
isTypeVerifiable
public boolean isTypeVerifiable(java.lang.String typeCode)
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
public boolean isAttributeVerifiable(java.lang.String typeCode, java.lang.String attribute)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
protected java.util.List<AttributePermissionForType> getPermissionConfigs()
-
setPermissionConfigs
public void setPermissionConfigs(java.util.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)
-
-