Class DefaultCMSPermissionChecker
java.lang.Object
de.hybris.platform.cmsfacades.types.service.impl.DefaultCMSPermissionChecker
- All Implemented Interfaces:
CMSPermissionChecker
Default implementation of
CMSPermissionChecker-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CMSAttributeTypeServiceprotected PermissionCRUDServiceprotected booleanhasPermission(AttributeDescriptorModel attribute, String permissionName, TypeModel attributeType) Verifies if the current principal has permissions to perform the specified operation (e.g.booleanhasPermissionForContainedType(AttributeDescriptorModel attribute, 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)
-
Constructor Details
-
DefaultCMSPermissionChecker
public DefaultCMSPermissionChecker()
-
-
Method Details
-
isAttributeTypeBlacklisted
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, 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, 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
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
-
setPermissionCRUDService
-
getCmsAttributeTypeService
-
setCmsAttributeTypeService
-