Interface GroupPermission
- All Known Implementing Classes:
GroupPermissionProvider
Group permission interface to manage group permissions.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddPermission(int executorId, int groupId, String permission, long time) Adds a specific permission to a group along with an expiration time.voidclearPermission(int groupId) Removes all permissions associated with the specified group.booleanexistsPermission(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.intgetCreatedBy(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.longgetExpiredTime(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.intgetModifiedBy(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.booleanDetermines whether a specified permission for a given group is expired.voidloadExpired(Group group) Loads all expired permissions or entities associated with a given group into the system for further processing or cleanup.voidremovePermission(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
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:
trueif the permission exists for the group, otherwisefalse.
-
addPermission
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
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
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
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
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
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
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
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:
trueif the specified permission is expired, otherwisefalse.
-
getCreatedBy
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
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
Timestamprepresenting the creation time of the permission, ornullif the permission does not exist or no creation time is available.
-
getModifiedBy
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
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
Timestampobject representing the last modification time of the specified permission, ornullif no modification record exists.
-
loadExpired
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.
-