Class UserPermissionProvider

java.lang.Object
de.murmelmeister.murmelapi.user.permission.UserPermissionProvider
All Implemented Interfaces:
UserPermission

public final class UserPermissionProvider extends Object implements UserPermission
  • Field Details

  • Constructor Details

    • UserPermissionProvider

      public UserPermissionProvider()
  • Method Details

    • createTable

      private void createTable(String tableName)
    • existsPermission

      public boolean existsPermission(int userId, String permission)
      Description copied from interface: UserPermission
      Checks if a permission exists.
      Specified by:
      existsPermission in interface UserPermission
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      True if the permission exists, otherwise false.
    • addPermission

      public void addPermission(int userId, int creatorId, String permission, long time)
      Description copied from interface: UserPermission
      Adds a permission to a user.
      Specified by:
      addPermission in interface UserPermission
      Parameters:
      userId - The id of the user.
      creatorId - The id of the creator.
      permission - The permission.
      time - The time the permission was added.
    • removePermission

      public void removePermission(int userId, String permission)
      Description copied from interface: UserPermission
      Removes a permission from a user.
      Specified by:
      removePermission in interface UserPermission
      Parameters:
      userId - The id of the user.
      permission - The permission.
    • clearPermission

      public void clearPermission(int userId)
      Description copied from interface: UserPermission
      Clears all permissions from a user.
      Specified by:
      clearPermission in interface UserPermission
      Parameters:
      userId - The id of the user.
    • getPermissions

      public List<String> getPermissions(int userId)
      Description copied from interface: UserPermission
      Obtains all permissions of a user.
      Specified by:
      getPermissions in interface UserPermission
      Parameters:
      userId - The id of the user.
      Returns:
      A list of all permissions of the user.
    • getCreatorId

      public int getCreatorId(int userId, String permission)
      Description copied from interface: UserPermission
      Obtains the creator id of a permission.
      Specified by:
      getCreatorId in interface UserPermission
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The creator id of the permission.
    • getCreatedTime

      public long getCreatedTime(int userId, String permission)
      Description copied from interface: UserPermission
      Obtains the created time of a permission.
      Specified by:
      getCreatedTime in interface UserPermission
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The created time of the permission.
    • getCreatedDate

      public String getCreatedDate(int userId, String permission)
      Description copied from interface: UserPermission
      Obtains the created date of a permission.
      Specified by:
      getCreatedDate in interface UserPermission
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The created date of the permission.
    • getExpiredTime

      public long getExpiredTime(int userId, String permission)
      Description copied from interface: UserPermission
      Obtains the expired time of a permission.
      Specified by:
      getExpiredTime in interface UserPermission
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The expired time of the permission.
    • getExpiredDate

      public String getExpiredDate(int userId, String permission)
      Description copied from interface: UserPermission
      Obtains the expired date of a permission.
      Specified by:
      getExpiredDate in interface UserPermission
      Parameters:
      userId - The id of the user.
      permission - The permission.
      Returns:
      The expired date of the permission.
    • setExpiredTime

      public String setExpiredTime(int userId, String permission, long time)
      Description copied from interface: UserPermission
      Sets the expired time of a permission.
      Specified by:
      setExpiredTime in interface UserPermission
      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

      public String addExpiredTime(int userId, String permission, long time)
      Description copied from interface: UserPermission
      Adds an expired time to a permission.
      Specified by:
      addExpiredTime in interface UserPermission
      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

      public String removeExpiredTime(int userId, String permission, long time)
      Description copied from interface: UserPermission
      Removes an expired time from a permission.
      Specified by:
      removeExpiredTime in interface UserPermission
      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

      public void loadExpired(User user)
      Description copied from interface: UserPermission
      Loads all expired permissions of a user.
      Specified by:
      loadExpired in interface UserPermission
      Parameters:
      user - The user.