Interface ConversationPermissionService

  • All Known Implementing Classes:
    ConversationPermissionServiceImpl

    public interface ConversationPermissionService
    The permission helper must be used to check permissions on actions to be executed in the context of a conversation like adding or removing participants or posting a voice message, etc.
    Author:
    Micha Kiener, Filip Hrisafov
    • Method Detail

      • checkCreateConversation

        @Deprecated
        Optional<String> checkCreateConversation​(String userId,
                                                 String parentConversationId,
                                                 ConversationBuilder conversationBuilder)
        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).
        Parameters:
        userId - the id of the user to check the permissions
        parentConversationId - the optional parent conversation, if the new one is a child (sub-conversation), might be null
        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

        Optional<String> 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. if creating a sub-conversation like a topic or ticket).
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        parentConversationId - the optional parent conversation, if the new one is a child (sub-conversation), might be null
        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
        Optional<String> checkUpdateConversationName​(String userId,
                                                     String conversationId)
        Evaluates the permissions for the given user when updating the conversation name.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - 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

        Optional<String> checkUpdateConversationName​(String userId,
                                                     Collection<String> userGroupKeys,
                                                     String userTenantId,
                                                     String conversationId)
        Evaluates the permissions for the given user when updating the conversation name.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - 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
        Optional<String> checkUpdateConversationDescription​(String userId,
                                                            String conversationId)
        Evaluates the permissions for the given user when updating the conversation description.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - 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

        Optional<String> checkUpdateConversationDescription​(String userId,
                                                            Collection<String> userGroupKeys,
                                                            String userTenantId,
                                                            String conversationId)
        Evaluates the permissions for the given user when updating the conversation description.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - 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
        Optional<String> checkArchiveConversation​(String userId,
                                                  String conversationId)
        Evaluates the permissions for the given user when archiving an existing conversation.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - 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

        Optional<String> checkArchiveConversation​(String userId,
                                                  Collection<String> userGroupKeys,
                                                  String userTenantId,
                                                  String conversationId)
        Evaluates the permissions for the given user when archiving an existing conversation.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - 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
        Optional<String> checkReopenConversation​(String userId,
                                                 String conversationId)
        Evaluates the permissions for the given user when re-opening an archived conversation.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - 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

        Optional<String> checkReopenConversation​(String userId,
                                                 Collection<String> userGroupKeys,
                                                 String userTenantId,
                                                 String conversationId)
        Evaluates the permissions for the given user when re-opening an archived conversation.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - 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
        Optional<String> checkJoinParticipantToExistingConversation​(String userId,
                                                                    String conversationId,
                                                                    String newParticipantUserId)
        Evaluates the permissions for the given user when inviting a new participant to an existing conversation.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - 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

        Optional<String> 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.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - 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
        Optional<String> checkDropParticipantFromConversation​(String userId,
                                                              String conversationId,
                                                              String droppedParticipantUserId)
        Evaluates the permissions for the given user when dropping a participant from a conversation.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - the id of the conversation from which the participant should be dropped
        droppedParticipantUserId - 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

        Optional<String> 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.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - the id of the conversation from which the participant should be dropped
        droppedParticipantUserId - 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
        Optional<String> checkPostMessage​(String userId,
                                          String conversationId)
        Evaluates the permissions for the given user when posting a message to a conversation.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - 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

        Optional<String> checkPostMessage​(String userId,
                                          Collection<String> userGroupKeys,
                                          String userTenantId,
                                          String conversationId)
        Evaluates the permissions for the given user when posting a message to a conversation.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - 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
        Optional<String> checkEditMessage​(String userId,
                                          String conversationId,
                                          String messageId)
        Evaluates the permissions for the given user when editing an existing message of a conversation.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - the id of the conversation to edit a message from
        messageId - 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

        Optional<String> 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.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - the id of the conversation to edit a message from
        messageId - 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
      • checkPostAction

        @Deprecated
        default Optional<String> checkPostAction​(String userId,
                                                 String conversationId,
                                                 String actionInstanceId,
                                                 String actionDefinitionId,
                                                 String actionDefinitionKey)
        Evaluates the permissions for the given user when posting an action message to a conversation. One of actionInstanceId, actionDefinitionId or actionDefinitionKey not null. If this method is not implemented it just invokes checkPostMessage(String, String)
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - the if of the conversation to post the message to
        actionInstanceId - the id of the action instance that would be linked to the message
        actionDefinitionId - the id of the action definition that should be used for creating the action instance for the message
        actionDefinitionKey - the key of the action definition that should be used for creating the action instance for the message
        Returns:
        the permissions error message, if it is not allowed to post the action, Optional.empty() if it is allowed
      • checkPostAction

        default Optional<String> checkPostAction​(String userId,
                                                 Collection<String> userGroupKeys,
                                                 String userTenantId,
                                                 String conversationId,
                                                 String actionInstanceId,
                                                 String actionDefinitionId,
                                                 String actionDefinitionKey)
        Evaluates the permissions for the given user when posting an action message to a conversation. One of actionInstanceId, actionDefinitionId or actionDefinitionKey not null. If this method is not implemented it just invokes checkPostMessage(String, String)
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - the if of the conversation to post the message to
        actionInstanceId - the id of the action instance that would be linked to the message
        actionDefinitionId - the id of the action definition that should be used for creating the action instance for the message
        actionDefinitionKey - the key of the action definition that should be used for creating the action instance for the message
        Returns:
        the permissions error message, if it is not allowed to post the action, Optional.empty() if it is allowed
      • checkPostMedia

        @Deprecated
        Optional<String> checkPostMedia​(String userId,
                                        String conversationId,
                                        String mimeType)
        Evaluates the permissions for the given user when posing a media to a conversation.
        Parameters:
        userId - the id of the user to check the permissions
        conversationId - the id of the conversation to post the media to
        mimeType - 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

        Optional<String> 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.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - the id of the conversation to post the media to
        mimeType - 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

        Optional<String> checkUpdateConversationAvatar​(String userId,
                                                       Collection<String> userGroupKeys,
                                                       String userTenantId,
                                                       String conversationId)
        Evaluates the permissions for the given user when posing a media to a conversation.
        Parameters:
        userId - the id of the user to check the permissions
        userGroupKeys - the group keys of the user to check the permissions
        userTenantId - the tenant id of the user to check the permissions
        conversationId - 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
      • fetchPermissions

        Collection<String> fetchPermissions​(Conversation conversation,
                                            String userId,
                                            Set<String> groupKeys,
                                            String tenantId)
        Fetch the permission actions that are allowed for the conversation for the given user
        Parameters:
        conversation - the conversation for which the actions should be fetched
        userId - the id of the user
        groupKeys - the group keys of the user
        tenantId - the tenant id of the user
        Returns:
        the collection of the permission actions