Interface SecurityService

  • All Known Implementing Classes:
    SecurityServiceImpl

    @Service
    public interface SecurityService
    Checks roles permissions.
    • Method Detail

      • getPermissionsOfUser

        UserPermission getPermissionsOfUser​(Account account,
                                            Directory directory)
                                     throws MopsException
        Gets all 3 permissions of a user in a directory.
        Parameters:
        account - user credentials
        directory - the directory
        Returns:
        a permission flag object
        Throws:
        MopsException
      • checkWritePermission

        void checkWritePermission​(Account account,
                                  Directory directory)
                           throws MopsException
        Checks if the user has writing rights.
        Parameters:
        account - user credentials
        directory - id of the directory to check
        Throws:
        MopsException - checked exception to present to UI
      • checkReadPermission

        void checkReadPermission​(Account account,
                                 Directory directory)
                          throws MopsException
        Checks if the user has reading rights.
        Parameters:
        account - user credentials
        directory - id of the directory to check
        Throws:
        MopsException - checked exception to present to UI
      • checkDeletePermission

        void checkDeletePermission​(Account account,
                                   Directory directory)
                            throws MopsException
        Checks if the user has deleting rights.
        Parameters:
        account - user credentials
        directory - id of the directory to check
        Throws:
        MopsException - checked exception to present to UI
      • isUserAdmin

        boolean isUserAdmin​(Account account,
                            long groupId)
                     throws MopsException
        Checks if user is has the admin role.
        Parameters:
        account - user credentials
        groupId - id of the group to check
        Returns:
        true if admin
        Throws:
        MopsException
      • checkIfRole

        void checkIfRole​(Account account,
                         long groupId,
                         java.lang.String allowedRole)
                  throws MopsException
        Checks if user is has a role.
        Parameters:
        account - user credentials
        groupId - id of the group to check
        allowedRole - role which has the right
        Throws:
        MopsException - checked exception to present to UI
      • getUserRole

        java.lang.String getUserRole​(long groupId,
                                     Account account)
                              throws MopsException
        Get the role of a given user in a group.
        Parameters:
        groupId - group to check
        account - given user
        Returns:
        user role
        Throws:
        MopsException