Class ConversationPermissionServiceImpl
java.lang.Object
com.flowable.engage.engine.impl.permission.ConversationPermissionServiceImpl
- All Implemented Interfaces:
ConversationPermissionService
public class ConversationPermissionServiceImpl
extends Object
implements ConversationPermissionService
The default implementation of the permission helper checking permissions for certain conversation related actions
with the help of a two-step DMN decision model approach.
There is a first, global DMN model where quick and fast permissions are checked first (e.g. nothing is allowed
within an archived conversation, etc). The result of that first step might say you need to check the actions detail
DMN table which is then the second step. There is a detailed DMN decision model for each action to check for
its particular permissions.
- Author:
- Micha Kiener, Filip Hrisafov
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConversationPermissionServiceImpl
(EngageEngineConfiguration engageEngineConfiguration) -
Method Summary
Modifier and TypeMethodDescriptioncheckArchiveConversation
(String userId, String conversationId) Deprecated.checkArchiveConversation
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when archiving an existing conversation.checkCreateConversation
(String userId, String parentConversationId, ConversationBuilder conversationBuilder) Deprecated.checkCreateConversation
(String userId, Collection<String> userGroupKeys, String userTenantId, String parentConversationId, ConversationBuilder conversationBuilder) Evaluates the permissions for the given user when creating a new conversation with an optional parent conversation (e.g.checkDropParticipantFromConversation
(String userId, String conversationId, String droppedParticipantUserId) Deprecated.checkDropParticipantFromConversation
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId, String droppedParticipantUserId) Evaluates the permissions for the given user when dropping a participant from a conversation.checkEditMessage
(String userId, String conversationId, String messageId) Deprecated.checkEditMessage
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId, String messageId) Evaluates the permissions for the given user when editing an existing message of a conversation.checkJoinParticipantToExistingConversation
(String userId, String conversationId, String newParticipantUserId) Deprecated.checkJoinParticipantToExistingConversation
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId, String newParticipantUserId) Evaluates the permissions for the given user when inviting a new participant to an existing conversation.checkPostDocument
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting a document to a conversation.checkPostImage
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting an image to a conversation.checkPostMedia
(String userId, String conversationId, String mimeType) Deprecated.checkPostMedia
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId, String mimeType) Evaluates the permissions for the given user when posing a media to a conversation.checkPostMessage
(String userId, String conversationId) Deprecated.checkPostMessage
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting a message to a conversation.checkPostVideoMessage
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting a video message to a conversation.checkPostVoiceMessage
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting a voice message to a conversation.checkReopenConversation
(String userId, String conversationId) Deprecated.checkReopenConversation
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when re-opening an archived conversation.checkUpdateConversationAvatar
(String userId, String conversationId) Deprecated.checkUpdateConversationAvatar
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posing a media to a conversation.checkUpdateConversationDescription
(String userId, String conversationId) Deprecated.checkUpdateConversationDescription
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when updating the conversation description.checkUpdateConversationName
(String userId, String conversationId) Deprecated.checkUpdateConversationName
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when updating the conversation name.protected Collection<String>
fetchExternalSystemSupportedSendMessageTypes
(Collection<String> userAccountIds) fetchPermissions
(Conversation conversation, String userId, Set<String> groupKeys, String tenantId) Fetch the permission actions that are allowed for the conversation for the given userboolean
hasAccessToConversation
(String userId, String conversationId) Deprecated.boolean
hasAccessToConversation
(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) protected String
mapExternalSystemSupportedMessageTypeToPermission
(String supportedType) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.flowable.engage.conversation.api.permission.ConversationPermissionService
checkPostAction, checkPostAction
-
Field Details
-
engageEngineConfiguration
-
-
Constructor Details
-
ConversationPermissionServiceImpl
-
-
Method Details
-
checkCreateConversation
@Deprecated public Optional<String> checkCreateConversation(String userId, String parentConversationId, ConversationBuilder conversationBuilder) Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when creating a new conversation with an optional parent conversation (e.g. if creating a sub-conversation like a topic or ticket).- Specified by:
checkCreateConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsparentConversationId
- the optional parent conversation, if the new one is a child (sub-conversation), might benull
conversationBuilder
- the builder having all the details of the new conversation to be started, needs at least type and subtype to be set- Returns:
- the permission error message, if permission is denied to start the new conversation or no message, if permission is granted
-
checkCreateConversation
public Optional<String> checkCreateConversation(String userId, Collection<String> userGroupKeys, String userTenantId, String parentConversationId, ConversationBuilder conversationBuilder) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when creating a new conversation with an optional parent conversation (e.g. if creating a sub-conversation like a topic or ticket).- Specified by:
checkCreateConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsparentConversationId
- the optional parent conversation, if the new one is a child (sub-conversation), might benull
conversationBuilder
- the builder having all the details of the new conversation to be started, needs at least type and subtype to be set- Returns:
- the permission error message, if permission is denied to start the new conversation or no message, if permission is granted
-
checkUpdateConversationName
@Deprecated public Optional<String> checkUpdateConversationName(String userId, String conversationId) Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when updating the conversation name.- Specified by:
checkUpdateConversationName
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation where the name is being changed- Returns:
- the permission error message, if permission is denied to change the conversation name or no message, if permission is granted
-
checkUpdateConversationName
public Optional<String> checkUpdateConversationName(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when updating the conversation name.- Specified by:
checkUpdateConversationName
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation where the name is being changed- Returns:
- the permission error message, if permission is denied to change the conversation name or no message, if permission is granted
-
checkUpdateConversationDescription
@Deprecated public Optional<String> checkUpdateConversationDescription(String userId, String conversationId) Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when updating the conversation description.- Specified by:
checkUpdateConversationDescription
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation where the description is being changed- Returns:
- the permission error message, if permission is denied to change the conversation description or no message, if permission is granted
-
checkUpdateConversationDescription
public Optional<String> checkUpdateConversationDescription(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when updating the conversation description.- Specified by:
checkUpdateConversationDescription
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation where the description is being changed- Returns:
- the permission error message, if permission is denied to change the conversation description or no message, if permission is granted
-
checkArchiveConversation
Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when archiving an existing conversation.- Specified by:
checkArchiveConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation to be archived- Returns:
- the permission error message, if permission is denied to archive the conversation or no message, if permission is granted
-
checkArchiveConversation
public Optional<String> checkArchiveConversation(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when archiving an existing conversation.- Specified by:
checkArchiveConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation to be archived- Returns:
- the permission error message, if permission is denied to archive the conversation or no message, if permission is granted
-
checkReopenConversation
Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when re-opening an archived conversation.- Specified by:
checkReopenConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation to be re-opened- Returns:
- the permission error message, if permission is denied to re-open the conversation or no message, if permission is granted
-
checkReopenConversation
public Optional<String> checkReopenConversation(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when re-opening an archived conversation.- Specified by:
checkReopenConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation to be re-opened- Returns:
- the permission error message, if permission is denied to re-open the conversation or no message, if permission is granted
-
checkJoinParticipantToExistingConversation
@Deprecated public Optional<String> checkJoinParticipantToExistingConversation(String userId, String conversationId, String newParticipantUserId) Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when inviting a new participant to an existing conversation.- Specified by:
checkJoinParticipantToExistingConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation to join the new participant to- Returns:
- the permission error message, if permission is denied to join the new participant or no message, if permission is granted
-
checkJoinParticipantToExistingConversation
public Optional<String> checkJoinParticipantToExistingConversation(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId, String newParticipantUserId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when inviting a new participant to an existing conversation.- Specified by:
checkJoinParticipantToExistingConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation to join the new participant to- Returns:
- the permission error message, if permission is denied to join the new participant or no message, if permission is granted
-
checkDropParticipantFromConversation
@Deprecated public Optional<String> checkDropParticipantFromConversation(String userId, String conversationId, String droppedParticipantUserId) Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when dropping a participant from a conversation.- Specified by:
checkDropParticipantFromConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation from which the participant should be droppeddroppedParticipantUserId
- the id of the participant user to be dropped- Returns:
- the permission error message, if permission is denied to drop the participant or no message, if permission is granted
-
checkDropParticipantFromConversation
public Optional<String> checkDropParticipantFromConversation(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId, String droppedParticipantUserId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when dropping a participant from a conversation.- Specified by:
checkDropParticipantFromConversation
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation from which the participant should be droppeddroppedParticipantUserId
- the id of the participant user to be dropped- Returns:
- the permission error message, if permission is denied to drop the participant or no message, if permission is granted
-
checkPostMessage
Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when posting a message to a conversation.- Specified by:
checkPostMessage
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation to post the message to- Returns:
- the permission error message, if permission is denied to post a message or no message, if permission is granted
-
checkPostMessage
public Optional<String> checkPostMessage(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when posting a message to a conversation.- Specified by:
checkPostMessage
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation to post the message to- Returns:
- the permission error message, if permission is denied to post a message or no message, if permission is granted
-
checkEditMessage
@Deprecated public Optional<String> checkEditMessage(String userId, String conversationId, String messageId) Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when editing an existing message of a conversation.- Specified by:
checkEditMessage
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation to edit a message frommessageId
- the id of the message to be edited- Returns:
- the permission error message, if permission is denied to edit a message or no message, if permission is granted
-
checkEditMessage
public Optional<String> checkEditMessage(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId, String messageId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when editing an existing message of a conversation.- Specified by:
checkEditMessage
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation to edit a message frommessageId
- the id of the message to be edited- Returns:
- the permission error message, if permission is denied to edit a message or no message, if permission is granted
-
checkPostMedia
@Deprecated public Optional<String> checkPostMedia(String userId, String conversationId, String mimeType) Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when posing a media to a conversation.- Specified by:
checkPostMedia
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation to post the media tomimeType
- the mime type of the media that is being posted- Returns:
- the permissions error message, if it is not allowed to the media,
Optional.empty()
if it is allowed
-
checkPostMedia
public Optional<String> checkPostMedia(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId, String mimeType) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when posing a media to a conversation.- Specified by:
checkPostMedia
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation to post the media tomimeType
- the mime type of the media that is being posted- Returns:
- the permissions error message, if it is not allowed to the media,
Optional.empty()
if it is allowed
-
checkUpdateConversationAvatar
@Deprecated public Optional<String> checkUpdateConversationAvatar(String userId, String conversationId) Deprecated.Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when posing a media to a conversation.- Specified by:
checkUpdateConversationAvatar
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsconversationId
- the id of the conversation to post the media to- Returns:
- the permissions error message, if it is not allowed to the media,
Optional.empty()
if it is allowed
-
checkUpdateConversationAvatar
public Optional<String> checkUpdateConversationAvatar(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Description copied from interface:ConversationPermissionService
Evaluates the permissions for the given user when posing a media to a conversation.- Specified by:
checkUpdateConversationAvatar
in interfaceConversationPermissionService
- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant id of the user to check the permissionsconversationId
- the id of the conversation to post the media to- Returns:
- the permissions error message, if it is not allowed to the media,
Optional.empty()
if it is allowed
-
checkPostVoiceMessage
protected Optional<String> checkPostVoiceMessage(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting a voice message to a conversation.- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant of the user to check the permissionsconversationId
- the id of the conversation to post the voice message to- Returns:
- the permission error message, if permission is denied to post a voice message or no message, if permission is granted
-
checkPostVideoMessage
protected Optional<String> checkPostVideoMessage(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting a video message to a conversation.- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant of the user to check the permissionsconversationId
- the id of the conversation to post the video message to- Returns:
- the permission error message, if permission is denied to post a video message or no message, if permission is granted
-
checkPostImage
protected Optional<String> checkPostImage(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting an image to a conversation.- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant of the user to check the permissionsconversationId
- the id of the conversation to post the image to- Returns:
- the permission error message, if permission is denied to post an image or no message, if permission is granted
-
checkPostDocument
protected Optional<String> checkPostDocument(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) Evaluates the permissions for the given user when posting a document to a conversation.- Parameters:
userId
- the id of the user to check the permissionsuserGroupKeys
- the group keys of the user to check the permissionsuserTenantId
- the tenant of the user to check the permissionsconversationId
- the id of the conversation to post the document to- Returns:
- the permission error message, if permission is denied to post a document or no message, if permission is granted
-
hasAccessToConversation
Deprecated.- Specified by:
hasAccessToConversation
in interfaceConversationPermissionService
-
hasAccessToConversation
public boolean hasAccessToConversation(String userId, Collection<String> userGroupKeys, String userTenantId, String conversationId) - Specified by:
hasAccessToConversation
in interfaceConversationPermissionService
-
fetchPermissions
public Collection<String> fetchPermissions(Conversation conversation, String userId, Set<String> groupKeys, String tenantId) Description copied from interface:ConversationPermissionService
Fetch the permission actions that are allowed for the conversation for the given user- Specified by:
fetchPermissions
in interfaceConversationPermissionService
- Parameters:
conversation
- the conversation for which the actions should be fetcheduserId
- the id of the usergroupKeys
- the group keys of the usertenantId
- the tenant id of the user- Returns:
- the collection of the permission actions
-
mapExternalSystemSupportedMessageTypeToPermission
-
fetchExternalSystemSupportedSendMessageTypes
protected Collection<String> fetchExternalSystemSupportedSendMessageTypes(Collection<String> userAccountIds)
-