Interface GroupPermission

All Known Implementing Classes:
GroupPermissionProvider

public sealed interface GroupPermission permits GroupPermissionProvider
Group permission interface to manage group permissions.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addPermission(int executorId, int groupId, String permission, long time)
    Adds a specific permission to a group along with an expiration time.
    void
    clearPermission(int groupId)
    Removes all permissions associated with the specified group.
    boolean
    existsPermission(int groupId, String permission)
    Checks if a specific permission exists for a given group.
    getAllPermissions(GroupParent groupParent, int groupId)
    Retrieves all permissions associated with a given group, including inherited permissions from its parent group if applicable.
    getCreatedAt(int groupId, String permission)
    Retrieves the timestamp of when the given permission was created for the specified group.
    int
    getCreatedBy(int groupId, String permission)
    Retrieves the ID of the user who created the specified permission for the given group.
    getExpiredDate(int groupId, String permission)
    Retrieves the expiration date of a specific permission for a given group.
    long
    getExpiredTime(int groupId, String permission)
    Retrieves the expiration time for a specific permission associated with a given group.
    getModifiedAt(int groupId, String permission)
    Retrieves the timestamp of the last modification made to a specific permission associated with a given group.
    int
    getModifiedBy(int groupId, String permission)
    Retrieves the user ID of the user who last modified the specified permission for a given group.
    getPermissions(int groupId)
    Retrieves a list of permissions associated with a specified group ID.
    boolean
    isExpired(int groupId, String permission)
    Determines whether a specified permission for a given group is expired.
    void
    Loads all expired permissions or entities associated with a given group into the system for further processing or cleanup.
    void
    removePermission(int groupId, String permission)
    Removes a specific permission from a group.
    setExpiredTime(int executorId, int groupId, String permission, long time)
    Sets the expiration time for a specific permission associated with a group.
  • Method Details

    • existsPermission

      boolean existsPermission(int groupId, String permission)
      Checks if a specific permission exists for a given group.
      Parameters:
      groupId - The ID of the group to check the permission for.
      permission - The name of the permission to verify.
      Returns:
      true if the permission exists for the group, otherwise false.
    • addPermission

      void addPermission(int executorId, int groupId, String permission, long time)
      Adds a specific permission to a group along with an expiration time.
      Parameters:
      executorId - The ID of the executor initiating the permission addition.
      groupId - The ID of the group to which the permission will be added.
      permission - The permission to add to the group.
      time - The expiration time in milliseconds. If set to -1, the permission will not expire.
    • removePermission

      void removePermission(int groupId, String permission)
      Removes a specific permission from a group.
      Parameters:
      groupId - The ID of the group from which the permission is to be removed.
      permission - The permission to be removed from the group.
    • clearPermission

      void clearPermission(int groupId)
      Removes all permissions associated with the specified group.
      Parameters:
      groupId - The unique identifier of the group whose permissions are to be cleared.
    • getPermissions

      List<String> getPermissions(int groupId)
      Retrieves a list of permissions associated with a specified group ID.
      Parameters:
      groupId - The ID of the group whose permissions are to be retrieved.
      Returns:
      A list of permissions associated with the given group ID.
    • getAllPermissions

      List<String> getAllPermissions(GroupParent groupParent, int groupId)
      Retrieves all permissions associated with a given group, including inherited permissions from its parent group if applicable.
      Parameters:
      groupParent - The parent group entity, which may provide inherited permissions to the group.
      groupId - The unique identifier of the group for which permissions are being retrieved.
      Returns:
      A list of permissions associated with the group, including inherited permissions if present.
    • getExpiredTime

      long getExpiredTime(int groupId, String permission)
      Retrieves the expiration time for a specific permission associated with a given group.
      Parameters:
      groupId - The ID of the group for which the permission expiration time is being retrieved.
      permission - The permission whose expiration time is being retrieved.
      Returns:
      The expiration time in milliseconds since epoch. Returns -1 if the permission has no expiration time, or -2 if the permission does not exist.
    • getExpiredDate

      String getExpiredDate(int groupId, String permission)
      Retrieves the expiration date of a specific permission for a given group. If the permission does not expire, the method will return "never".
      Parameters:
      groupId - The ID of the group associated with the permission.
      permission - The specific permission to retrieve the expiration date for.
      Returns:
      A string representation of the expiration date. Returns "never" if the permission does not expire.
    • setExpiredTime

      String setExpiredTime(int executorId, int groupId, String permission, long time)
      Sets the expiration time for a specific permission associated with a group. The expiration time can be specified to indicate when the permission should expire.
      Parameters:
      executorId - The ID of the user or process making the change.
      groupId - The ID of the group associated with the permission.
      permission - The name of the permission whose expiration time is being set.
      time - The expiration time in milliseconds from the current time; use -1 for no expiration.
      Returns:
      A string representation of the new expiration date, or "never" if no expiration is set.
    • isExpired

      boolean isExpired(int groupId, String permission)
      Determines whether a specified permission for a given group is expired.
      Parameters:
      groupId - The ID of the group to check the permission for.
      permission - The name of the permission to check for expiration.
      Returns:
      true if the specified permission is expired, otherwise false.
    • getCreatedBy

      int getCreatedBy(int groupId, String permission)
      Retrieves the ID of the user who created the specified permission for the given group.
      Parameters:
      groupId - The ID of the group for which the permission was created.
      permission - The name of the permission to retrieve the creator information for.
      Returns:
      The ID of the user who created the permission, or -2 if no such permission exists.
    • getCreatedAt

      Timestamp getCreatedAt(int groupId, String permission)
      Retrieves the timestamp of when the given permission was created for the specified group.
      Parameters:
      groupId - The ID of the group for which the permission was created.
      permission - The specific permission whose creation timestamp is to be retrieved.
      Returns:
      A Timestamp representing the creation time of the permission, or null if the permission does not exist or no creation time is available.
    • getModifiedBy

      int getModifiedBy(int groupId, String permission)
      Retrieves the user ID of the user who last modified the specified permission for a given group.
      Parameters:
      groupId - The ID of the group whose permission modification details are being queried.
      permission - The name of the permission for which the modifying user is being retrieved.
      Returns:
      The ID of the user who last modified the specified permission. If no modification was found, returns -2 as a fallback.
    • getModifiedAt

      Timestamp getModifiedAt(int groupId, String permission)
      Retrieves the timestamp of the last modification made to a specific permission associated with a given group.
      Parameters:
      groupId - The unique identifier of the group the permission belongs to.
      permission - The name of the permission whose modification timestamp is to be retrieved.
      Returns:
      A Timestamp object representing the last modification time of the specified permission, or null if no modification record exists.
    • loadExpired

      void loadExpired(Group group)
      Loads all expired permissions or entities associated with a given group into the system for further processing or cleanup.
      Parameters:
      group - The group for which expired permissions or entities will be loaded.