Class GroupPermissionProvider
java.lang.Object
de.murmelmeister.murmelapi.group.permission.GroupPermissionProvider
- All Implemented Interfaces:
GroupPermission
-
Constructor Summary
Constructors -
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.static void
-
Constructor Details
-
GroupPermissionProvider
-
-
Method Details
-
setup
-
existsPermission
Description copied from interface:GroupPermissionChecks if a specific permission exists for a given group.- Specified by:
existsPermissionin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionAdds a specific permission to a group along with an expiration time.- Specified by:
addPermissionin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionRemoves a specific permission from a group.- Specified by:
removePermissionin interfaceGroupPermission- 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
public void clearPermission(int groupId) Description copied from interface:GroupPermissionRemoves all permissions associated with the specified group.- Specified by:
clearPermissionin interfaceGroupPermission- Parameters:
groupId- The unique identifier of the group whose permissions are to be cleared.
-
getPermissions
Description copied from interface:GroupPermissionRetrieves a list of permissions associated with a specified group ID.- Specified by:
getPermissionsin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionRetrieves all permissions associated with a given group, including inherited permissions from its parent group if applicable.- Specified by:
getAllPermissionsin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionRetrieves the expiration time for a specific permission associated with a given group.- Specified by:
getExpiredTimein interfaceGroupPermission- 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
Description copied from interface:GroupPermissionRetrieves the expiration date of a specific permission for a given group. If the permission does not expire, the method will return "never".- Specified by:
getExpiredDatein interfaceGroupPermission- 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
Description copied from interface:GroupPermissionSets the expiration time for a specific permission associated with a group. The expiration time can be specified to indicate when the permission should expire.- Specified by:
setExpiredTimein interfaceGroupPermission- 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
Description copied from interface:GroupPermissionDetermines whether a specified permission for a given group is expired.- Specified by:
isExpiredin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionRetrieves the ID of the user who created the specified permission for the given group.- Specified by:
getCreatedByin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionRetrieves the timestamp of when the given permission was created for the specified group.- Specified by:
getCreatedAtin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionRetrieves the user ID of the user who last modified the specified permission for a given group.- Specified by:
getModifiedByin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionRetrieves the timestamp of the last modification made to a specific permission associated with a given group.- Specified by:
getModifiedAtin interfaceGroupPermission- 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
Description copied from interface:GroupPermissionLoads all expired permissions or entities associated with a given group into the system for further processing or cleanup.- Specified by:
loadExpiredin interfaceGroupPermission- Parameters:
group- The group for which expired permissions or entities will be loaded.
-