Interface UserPermission

All Known Implementing Classes:
UserPermissionProvider

public sealed interface UserPermission permits UserPermissionProvider
User permission interface to manage user permissions.
  • Method Details

    • existsPermission

      boolean existsPermission(int userId, String permission)
      Checks if a permission exists.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      True if the permission exists, otherwise false.
    • addPermission

      void addPermission(int userId, int creatorId, String permission, long time)
      Adds a permission to a user.
      Parameters:
      userId - The id of the user.
      creatorId - The id of the creator.
      permission - The permission.
      time - The time the permission was added.
    • removePermission

      void removePermission(int userId, String permission)
      Removes a permission from a user.
      Parameters:
      userId - The id of the user.
      permission - The permission.
    • clearPermission

      void clearPermission(int userId)
      Clears all permissions from a user.
      Parameters:
      userId - The id of the user.
    • getPermissions

      List<String> getPermissions(int userId)
      Obtains all permissions of a user.
      Parameters:
      userId - The id of the user.
      Returns:
      A list of all permissions of the user.
    • getCreatorId

      int getCreatorId(int userId, String permission)
      Obtains the creator id of a permission.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The creator id of the permission.
    • getCreatedTime

      long getCreatedTime(int userId, String permission)
      Obtains the created time of a permission.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The created time of the permission.
    • getCreatedDate

      String getCreatedDate(int userId, String permission)
      Obtains the created date of a permission.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The created date of the permission.
    • getExpiredTime

      long getExpiredTime(int userId, String permission)
      Obtains the expired time of a permission.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The expired time of the permission.
    • getExpiredDate

      String getExpiredDate(int userId, String permission)
      Obtains the expired date of a permission.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The expired date of the permission.
    • setExpiredTime

      String setExpiredTime(int userId, String permission, long time)
      Sets the expired time of a permission.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      time - The time the permission will expire.
      Returns:
      The expired date of the permission.
    • addExpiredTime

      String addExpiredTime(int userId, String permission, long time)
      Adds an expired time to a permission.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      time - The time to add to the expired time.
      Returns:
      The expired date of the permission.
    • removeExpiredTime

      String removeExpiredTime(int userId, String permission, long time)
      Removes an expired time from a permission.
      Parameters:
      userId - The id of the user.
      permission - The permission.
      time - The time to remove from the expired time.
      Returns:
      The expired date of the permission.
    • loadExpired

      void loadExpired(User user)
      Loads all expired permissions of a user.
      Parameters:
      user - The user.