Interface CachedPermissionManagement
- All Superinterfaces:
PermissionManagement
- All Known Implementing Classes:
DefaultCachedPermissionManagement
Represents a permission management instance which maintains a cache for permission users and groups internally to
allow faster loading times (for example looking up the user in the cache rather than the database).
- Since:
- 4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidacquireLock(@NonNull PermissionGroup group) Acquires a lock for the permission group.voidAcquires a lock for the permission user.cachedGroup(@NonNull String name) Searches the permission group cache for a permission group with the given name.Gets a map with all cached permission groups mapped to their name.Gets a map with all cached permission users mapped to their uuid.cachedUser(@NonNull UUID uniqueId) Searches the permission user cache for a permission user with the given unique id.booleanlocked(@NonNull PermissionGroup group) Checks if the given group has any locks locking the group in the cache.booleanlocked(@NonNull PermissionUser user) Checks if the given user has any locks locking the user in the cache.voidunlock(@NonNull PermissionGroup group) Removes exactly one lock of the group.voidunlock(@NonNull PermissionUser user) Removes exactly one lock of the user.voidunlockFully(@NonNull PermissionGroup group) Removes all locks that the given group has.voidRemoves all locks that the given user has.Methods inherited from interface eu.cloudnetservice.driver.permission.PermissionManagement
addGroupAsync, addPermissionGroup, addPermissionGroup, addPermissionGroupAsync, addPermissionUser, addPermissionUser, addPermissionUserAsync, addUserAsync, allGroupPermissions, allPermissions, childPermissionManagement, close, containsGroup, containsGroupAsync, containsOneUser, containsOneUserAsync, containsUser, containsUserAsync, defaultPermissionGroup, defaultPermissionGroupAsync, deleteGroup, deleteGroupAsync, deletePermissionGroup, deletePermissionGroupAsync, deletePermissionUser, deletePermissionUserAsync, deleteUser, deleteUserAsync, findHighestPermission, firstUser, firstUserAsync, getOrCreateUser, getOrCreateUserAsync, group, groupAsync, groupPermissionResult, groups, groups, groupsAsync, groupsAsync, groupsOf, groupsOfAsync, groupsPermissionResult, hasGroupPermission, hasPermission, highestPermissionGroup, init, modifyGroup, modifyGroupAsync, modifyUser, modifyUserAsync, modifyUsers, modifyUsersAsync, permissionResult, reload, sendCommandLine, sendCommandLineAsync, testPermissible, testPermissionUser, updateGroup, updateGroupAsync, updateUser, updateUserAsync, user, userAsync, users, usersAsync, usersByGroup, usersByGroupAsync, usersByName, usersByNameAsync
-
Method Details
-
cachedPermissionUsers
Gets a map with all cached permission users mapped to their uuid.- Returns:
- all cached permission users.
-
cachedPermissionGroups
Gets a map with all cached permission groups mapped to their name.- Returns:
- all cached permission groups.
-
cachedUser
Searches the permission user cache for a permission user with the given unique id.- Parameters:
uniqueId- the unique id associated with the permission user.- Returns:
- the cached permission user for the given unique id, null if no user was found in the cache.
- Throws:
NullPointerException- if the given unique id is null.
-
cachedGroup
Searches the permission group cache for a permission group with the given name.- Parameters:
name- the name associated with the permission group.- Returns:
- the cached permission group for the given name, null if no group was found in the cache.
- Throws:
NullPointerException- if the given name is null.
-
acquireLock
Acquires a lock for the permission user. The lock ensures that the user stays in cache.Each method call results in incrementing the lock count of the user. It's ensured that the user stays in the cache until the lock count is decreased again and reaches 0. After that event the normal cache invalidation rules of the permission management take effect again.
- Parameters:
user- the user to acquire the lock for.- Throws:
NullPointerException- if the given user is null.
-
acquireLock
Acquires a lock for the permission group. The lock ensures that the group stays in cache.Each method call results in incrementing the lock count of the group. It's ensured that the group stays in the cache until the lock count is decreased again and reaches 0. After that event the normal cache invalidation rules of the permission management take effect again.
- Parameters:
group- the group to acquire the lock for.- Throws:
NullPointerException- if the given group is null.
-
locked
Checks if the given user has any locks locking the user in the cache.- Parameters:
user- the user to check for locks.- Returns:
- true if there are any locks for the given user, false otherwise.
- Throws:
NullPointerException- if the given user is null.
-
locked
Checks if the given group has any locks locking the group in the cache.- Parameters:
group- the group to check for locks.- Returns:
- true if there are any locks for the given group, false otherwise.
- Throws:
NullPointerException- if the given group is null.
-
unlock
Removes exactly one lock of the user. If the user does not have any locks no changes are made. It's ensured that the user stays in the cache until the lock count is decreased again and reaches 0. After that event the normal cache invalidation rules of the permission management take effect again.- Parameters:
user- the user to remove a lock for.- Throws:
NullPointerException- if the given user is null.
-
unlock
Removes exactly one lock of the group. If the group does not have any locks no changes are made. It's ensured that the group stays in the cache until the lock count is decreased again and reaches 0. After that event the normal cache invalidation rules of the permission management take effect again.- Parameters:
group- the group to remove a lock for.- Throws:
NullPointerException- if the given group is null.
-
unlockFully
Removes all locks that the given user has. After that event the normal cache invalidation rules of the permission management take effect again.- Parameters:
user- the user to unlock completely.- Throws:
NullPointerException- if the given user is null.
-
unlockFully
Removes all locks that the given group has. After that event the normal cache invalidation rules of the permission management take effect again.- Parameters:
group- the group to unlock completely.- Throws:
NullPointerException- if the given group is null.
-