Class DefaultCMSPermissionChecker
- java.lang.Object
-
- de.hybris.platform.cmsfacades.types.service.impl.DefaultCMSPermissionChecker
-
- All Implemented Interfaces:
CMSPermissionChecker
public class DefaultCMSPermissionChecker extends java.lang.Object implements CMSPermissionChecker
Default implementation ofCMSPermissionChecker
-
-
Constructor Summary
Constructors Constructor Description DefaultCMSPermissionChecker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CMSAttributeTypeServicegetCmsAttributeTypeService()protected PermissionCRUDServicegetPermissionCRUDService()protected booleanhasPermission(AttributeDescriptorModel attribute, java.lang.String permissionName, TypeModel attributeType)Verifies if the current principal has permissions to perform the specified operation (e.g.booleanhasPermissionForContainedType(AttributeDescriptorModel attribute, java.lang.String permissionName)Type permission checking to see if the current principal has permissions to perform the specified operation (e.g.protected booleanhasReadPermission(AttributeDescriptorModel attribute, TypeModel attributeType)Verifies if the current principal has read permission on an attribute or not.protected booleanisAttributeTypeBlacklisted(TypeModel attributeType)Method that returns true if the attribute type is not applicable for permission checking.voidsetCmsAttributeTypeService(CMSAttributeTypeService typeService)voidsetPermissionCRUDService(PermissionCRUDService permissionCRUDService)
-
-
-
Method Detail
-
isAttributeTypeBlacklisted
protected boolean isAttributeTypeBlacklisted(TypeModel attributeType)
Method that returns true if the attribute type is not applicable for permission checking. Currently typeMediaModelis not applicable for type permission checking.
-
hasPermissionForContainedType
public boolean hasPermissionForContainedType(AttributeDescriptorModel attribute, java.lang.String permissionName)
Type permission checking to see if the current principal has permissions to perform the specified operation (e.g. read, change, create or remove) on the type of an attribute or not.- When the attribute is of type ComposedTypeModel, this method verifies that the type specified in the ComposedTypeModel is manageable by the current user.
- When the attribute is of type AtomicTypeModel, no additional type checking needs to be done. This will always
return
TRUE.
Possible scenarios are listed in the table below:
Sample Attribute Attribute Expected Result String nameAtomic type always TRUEMedia mediaComposed type TRUEwhen user has permission for Media typeList<MediaModel> mediaCollection of Composed type TRUEwhen user has permission for Media typeMap<String, MediaModel> mediaLocalized Composed type TRUEwhen user has permission for Media typeMap<String, List<MediaModel>> mediaLocalized Collection of Composed type TRUEwhen user has permission for Media type- Specified by:
hasPermissionForContainedTypein interfaceCMSPermissionCheckerpermissionName- - The name of the permission to be checked; valid values defined inPermissionsConstants- Returns:
- true if the current principal has been granted change permission on the type contained in the
non-primitive attribute or the attribute is of type
AtomicTypeModel; false otherwise. - Throws:
TypePermissionException- when principal cannotREADthe type contained in a required attribute.
-
hasPermission
protected boolean hasPermission(AttributeDescriptorModel attribute, java.lang.String permissionName, TypeModel attributeType)
Verifies if the current principal has permissions to perform the specified operation (e.g. read, change, create or remove) on an attribute or not.- Parameters:
attribute- - The descriptor that specifies the attribute whose permission to check.permissionName- - The name of the permission to be checked; valid values defined inPermissionsConstantsattributeType- - TheTypeModelof the attribute- Returns:
TRUEwhen the user has permission to perform the specified operation on the attribute;FALSEotherwise.
-
hasReadPermission
protected boolean hasReadPermission(AttributeDescriptorModel attribute, TypeModel attributeType)
Verifies if the current principal has read permission on an attribute or not.- Parameters:
attribute- - The descriptor that specifies the attribute whose permission to check.attributeType- - TheTypeModelof the attribute- Returns:
TRUEwhen the user has read permission on the attribute;FALSEotherwise.
-
getPermissionCRUDService
protected PermissionCRUDService getPermissionCRUDService()
-
setPermissionCRUDService
public void setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
-
getCmsAttributeTypeService
protected CMSAttributeTypeService getCmsAttributeTypeService()
-
setCmsAttributeTypeService
public void setCmsAttributeTypeService(CMSAttributeTypeService typeService)
-
-