public class DefaultCMSPermissionCachedCRUDService extends java.lang.Object implements PermissionCRUDService
PermissionCRUDService that supports caching.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
KEY_DELIMITER |
| Constructor and Description |
|---|
DefaultCMSPermissionCachedCRUDService() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAttributePermissionToCache(java.lang.String permissionName,
java.lang.String typeCode,
java.lang.String qualifier,
boolean hasPermission)
Adds attribute permission to the cache.
|
protected void |
addTypePermissionToCache(java.lang.String permissionName,
java.lang.String typeCode,
boolean hasPermission)
Adds type permission to the cache.
|
boolean |
canChangeAttribute(AttributeDescriptorModel attributeDescriptor)
Returns true if the current user is granted
PermissionsConstants.CHANGE permission to the given attribute
descriptor. |
boolean |
canChangeAttribute(java.lang.String typeCode,
java.lang.String attributeQualifier)
Returns true if the current user is granted
PermissionsConstants.CHANGE permission to the given attribute
descriptor. |
boolean |
canChangeAttributePermission(AttributeDescriptorModel attributeDescriptor)
Returns true if the current user is granted
PermissionsConstants.CHANGE_PERMISSIONS permission to the
given attribute descriptor. |
boolean |
canChangeAttributePermission(java.lang.String typeCode,
java.lang.String attributeQualifier)
Returns true if the current user is granted
PermissionsConstants.CHANGE_PERMISSIONS permission to the
given attribute descriptor. |
boolean |
canChangeType(ComposedTypeModel type)
Returns true if the current user is granted
PermissionsConstants.CHANGE permission to the given type. |
boolean |
canChangeType(java.lang.String typeCode)
Returns true if the current user is granted
PermissionsConstants.CHANGE permission to the given type. |
boolean |
canChangeTypePermission(ComposedTypeModel type)
Returns true if the current user is granted
PermissionsConstants.CHANGE_PERMISSIONS permission to the
given type. |
boolean |
canChangeTypePermission(java.lang.String typeCode)
Returns true if the current user is granted
PermissionsConstants.CHANGE_PERMISSIONS permission to the
given type. |
boolean |
canCreateTypeInstance(ComposedTypeModel type)
Returns true if the current user is granted
PermissionsConstants.CREATE permission to the given type. |
boolean |
canCreateTypeInstance(java.lang.String typeCode)
Returns true if the current user is granted
PermissionsConstants.CREATE permission to the given type. |
boolean |
canReadAttribute(AttributeDescriptorModel attributeDescriptor)
Returns true if the current user is granted
PermissionsConstants.READ permission to the given attribute
descriptor. |
boolean |
canReadAttribute(java.lang.String typeCode,
java.lang.String attributeQualifier)
Returns true if the current user is granted
PermissionsConstants.READ permission to the given attribute
descriptor. |
boolean |
canReadType(ComposedTypeModel type)
Returns true if the current user is granted
PermissionsConstants.READ permission to the given type. |
boolean |
canReadType(java.lang.String typeCode)
Returns true if the current user is granted
PermissionsConstants.READ permission to the given type. |
boolean |
canRemoveTypeInstance(ComposedTypeModel type)
Returns true if the current user is granted
PermissionsConstants.REMOVE permission to the given type. |
boolean |
canRemoveTypeInstance(java.lang.String typeCode)
Returns true if the current user is granted
PermissionsConstants.REMOVE permission to the given type. |
protected boolean |
getOrSetCachedAttributePermission(java.lang.String permissionName,
AttributeDescriptorModel attributeDescriptor,
java.util.function.BiFunction<java.lang.String,java.lang.String,java.lang.Boolean> permissionChecker) |
protected boolean |
getOrSetCachedAttributePermission(java.lang.String permissionName,
java.lang.String typeCode,
java.lang.String qualifier,
java.util.function.BiFunction<java.lang.String,java.lang.String,java.lang.Boolean> permissionChecker)
Returns attribute permission from the cache if it exists, calculates the permission and puts to the cache otherwise.
|
protected boolean |
getOrSetCachedTypePermission(java.lang.String permissionName,
ComposedTypeModel composedType,
java.util.function.Function<java.lang.String,java.lang.Boolean> permissionChecker) |
protected boolean |
getOrSetCachedTypePermission(java.lang.String permissionName,
java.lang.String typeCode,
java.util.function.Function<java.lang.String,java.lang.Boolean> permissionChecker)
Returns type permission from the cache if it exists, calculates the permission and puts to the cache otherwise.
|
protected PermissionCRUDService |
getPermissionCRUDService() |
protected SessionCachedContextProvider |
getSessionCachedContextProvider() |
protected java.lang.String |
getUniqueAttributeKey(java.lang.String permissionName,
java.lang.String typeCode,
java.lang.String qualifier)
Generates a unique name to store attribute permission in the cache
|
protected java.lang.String |
getUniqueTypeKey(java.lang.String permissionName,
java.lang.String typeCode) |
void |
setPermissionCRUDService(PermissionCRUDService permissionCRUDService) |
void |
setSessionCachedContextProvider(SessionCachedContextProvider sessionCachedContextProvider) |
public static final java.lang.String KEY_DELIMITER
public DefaultCMSPermissionCachedCRUDService()
public boolean canReadAttribute(AttributeDescriptorModel attributeDescriptor)
PermissionCRUDServicePermissionsConstants.READ permission to the given attribute
descriptor. Returns false otherwise.canReadAttribute in interface PermissionCRUDServicepublic boolean canReadAttribute(java.lang.String typeCode,
java.lang.String attributeQualifier)
PermissionCRUDServicePermissionsConstants.READ permission to the given attribute
descriptor. Returns false otherwise.canReadAttribute in interface PermissionCRUDServicepublic boolean canChangeAttribute(AttributeDescriptorModel attributeDescriptor)
PermissionCRUDServicePermissionsConstants.CHANGE permission to the given attribute
descriptor. Returns false otherwise.canChangeAttribute in interface PermissionCRUDServicepublic boolean canChangeAttribute(java.lang.String typeCode,
java.lang.String attributeQualifier)
PermissionCRUDServicePermissionsConstants.CHANGE permission to the given attribute
descriptor. Returns false otherwise.canChangeAttribute in interface PermissionCRUDServicepublic boolean canReadType(ComposedTypeModel type)
PermissionCRUDServicePermissionsConstants.READ permission to the given type.
Returns false otherwise.canReadType in interface PermissionCRUDServicepublic boolean canReadType(java.lang.String typeCode)
PermissionCRUDServicePermissionsConstants.READ permission to the given type.
Returns false otherwise.canReadType in interface PermissionCRUDServicepublic boolean canChangeType(ComposedTypeModel type)
PermissionCRUDServicePermissionsConstants.CHANGE permission to the given type.
Returns false otherwise.canChangeType in interface PermissionCRUDServicepublic boolean canChangeType(java.lang.String typeCode)
PermissionCRUDServicePermissionsConstants.CHANGE permission to the given type.
Returns false otherwise.canChangeType in interface PermissionCRUDServicepublic boolean canCreateTypeInstance(ComposedTypeModel type)
PermissionCRUDServicePermissionsConstants.CREATE permission to the given type.
Returns false otherwise.canCreateTypeInstance in interface PermissionCRUDServicepublic boolean canCreateTypeInstance(java.lang.String typeCode)
PermissionCRUDServicePermissionsConstants.CREATE permission to the given type.
Returns false otherwise.canCreateTypeInstance in interface PermissionCRUDServicepublic boolean canRemoveTypeInstance(ComposedTypeModel type)
PermissionCRUDServicePermissionsConstants.REMOVE permission to the given type.
Returns false otherwise.canRemoveTypeInstance in interface PermissionCRUDServicepublic boolean canRemoveTypeInstance(java.lang.String typeCode)
PermissionCRUDServicePermissionsConstants.REMOVE permission to the given type.
Returns false otherwise.canRemoveTypeInstance in interface PermissionCRUDServicepublic boolean canChangeTypePermission(ComposedTypeModel type)
PermissionCRUDServicePermissionsConstants.CHANGE_PERMISSIONS permission to the
given type. Returns false otherwise.canChangeTypePermission in interface PermissionCRUDServicepublic boolean canChangeTypePermission(java.lang.String typeCode)
PermissionCRUDServicePermissionsConstants.CHANGE_PERMISSIONS permission to the
given type. Returns false otherwise.canChangeTypePermission in interface PermissionCRUDServicepublic boolean canChangeAttributePermission(AttributeDescriptorModel attributeDescriptor)
PermissionCRUDServicePermissionsConstants.CHANGE_PERMISSIONS permission to the
given attribute descriptor. Returns false otherwise.canChangeAttributePermission in interface PermissionCRUDServicepublic boolean canChangeAttributePermission(java.lang.String typeCode,
java.lang.String attributeQualifier)
PermissionCRUDServicePermissionsConstants.CHANGE_PERMISSIONS permission to the
given attribute descriptor. Returns false otherwise.canChangeAttributePermission in interface PermissionCRUDServiceprotected boolean getOrSetCachedTypePermission(java.lang.String permissionName,
java.lang.String typeCode,
java.util.function.Function<java.lang.String,java.lang.Boolean> permissionChecker)
permissionName - permission nametypeCode - type codepermissionChecker - the Function to verify permission if it does not exist in the cache.protected boolean getOrSetCachedTypePermission(java.lang.String permissionName,
ComposedTypeModel composedType,
java.util.function.Function<java.lang.String,java.lang.Boolean> permissionChecker)
protected boolean getOrSetCachedAttributePermission(java.lang.String permissionName,
java.lang.String typeCode,
java.lang.String qualifier,
java.util.function.BiFunction<java.lang.String,java.lang.String,java.lang.Boolean> permissionChecker)
permissionName - permission nametypeCode - type codequalifier - attribute qualifierpermissionChecker - the BiFunction to verify permission if it does not exist in the cache.protected boolean getOrSetCachedAttributePermission(java.lang.String permissionName,
AttributeDescriptorModel attributeDescriptor,
java.util.function.BiFunction<java.lang.String,java.lang.String,java.lang.Boolean> permissionChecker)
protected void addAttributePermissionToCache(java.lang.String permissionName,
java.lang.String typeCode,
java.lang.String qualifier,
boolean hasPermission)
permissionName - permission nametypeCode - type codequalifier - attribute qualifierhasPermission - true if current user has permission, false otherwise.protected void addTypePermissionToCache(java.lang.String permissionName,
java.lang.String typeCode,
boolean hasPermission)
permissionName - permission nametypeCode - type codehasPermission - true if current user has permission, false otherwise.protected java.lang.String getUniqueAttributeKey(java.lang.String permissionName,
java.lang.String typeCode,
java.lang.String qualifier)
permissionName - permission nametypeCode - type codequalifier - attribute qualifierprotected java.lang.String getUniqueTypeKey(java.lang.String permissionName,
java.lang.String typeCode)
protected SessionCachedContextProvider getSessionCachedContextProvider()
public void setSessionCachedContextProvider(SessionCachedContextProvider sessionCachedContextProvider)
protected PermissionCRUDService getPermissionCRUDService()
public void setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
Copyright © 2018 SAP SE. All Rights Reserved.