Contents
- Description
- Method Summary
- Method Details
- getName()
- addUserPermissions(UUID, Set)
- removeUserPermissions(UUID, Set)
- getUserPermissions(UUID)
- addGroupPermissions(String, Set)
- removeGroupPermissions(String, Set)
- getGroupPermissions(String)
- addUserToGroup(UUID, String)
- removeUserFromGroup(UUID, String)
- getGroupsForUser(UUID)
- setUserGroup(UUID, String)
- getGroupParent(String)
- getAllRegisteredGroups()
- getEffectiveGroupPermissions(String)
- getUsersWithPermission(String)
- addUserPermissions(Collection, Set)
- removeUserPermissionFromAll(String)
Interface PermissionProvider
- All Known Implementing Classes:
HytalePermissionsProvider
public interface PermissionProvider
An interface for anything that can provide permissions.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddGroupPermissions(String group, Set<String> permissions) Called to add a set of permissions to a group.addUserPermissions(Collection<UUID> uuids, Set<String> permissions) Adds the permissions to every user named.voidaddUserPermissions(UUID uuid, Set<String> permissions) Called to add a set of permissions to a user.voidaddUserToGroup(UUID uuid, String group) Called to add a user to a group.Resolves the full set of permissions for a group, including inherited permissions from the parent chain.getGroupParent(String group) getGroupPermissions(String group) Called to get the direct (non-inherited) set of permissions for a group.getGroupsForUser(UUID uuid) Called to get the set of groups a user is in.getName()getUserPermissions(UUID uuid) Called to get the set of permissions for a user.getUsersWithPermission(String permission) Finds the users that hold the permission as a grant of their own.voidremoveGroupPermissions(String group, Set<String> permissions) Called to remove a set of permissions from a group.voidremoveUserFromGroup(UUID uuid, String group) Called to remove a user from a group.removeUserPermissionFromAll(String permission) Takes the permission back from every user that holds it as a grant of their own, as one change.voidremoveUserPermissions(UUID uuid, Set<String> permissions) Called to remove a set of permissions from a user.voidsetUserGroup(UUID uuid, String group) Atomically replaces all groups for a user with the given single group.
-
Method Details
-
getName
- Returns:
- the name of the permission provider.
-
addUserPermissions
-
removeUserPermissions
-
getUserPermissions
-
addGroupPermissions
-
removeGroupPermissions
-
getGroupPermissions
-
addUserToGroup
-
removeUserFromGroup
-
getGroupsForUser
-
setUserGroup
-
getGroupParent
-
getAllRegisteredGroups
-
getEffectiveGroupPermissions
Resolves the full set of permissions for a group, including inherited permissions from the parent chain. Implementations must protect against cycles.- Parameters:
group- The name of the group.- Returns:
- the effective permission set (direct + inherited).
-
getUsersWithPermission
Finds the users that hold the permission as a grant of their own. A user who holds it through a group is not one of them, and neither is a user who holds it through a wildcard.This carries no default, because a provider that answers "nobody" when it means "I cannot tell" makes
removeUserPermissionFromAll(String)report that it revoked a permission that the user still holds.- Parameters:
permission- The permission node.- Returns:
- the users that were granted the permission.
-
addUserPermissions
@Nonnull default Set<UUID> addUserPermissions(@Nonnull Collection<UUID> uuids, @Nonnull Set<String> permissions) Adds the permissions to every user named. Override this to store the change once rather than once for each user. The default adds them one user at a time, so a failure part way through leaves the users before it changed and reports none of them.- Parameters:
uuids- TheUUIDof each user.permissions- The set of permissions to add.- Returns:
- the users the permissions were added to, which leaves out the users that held them.
-
removeUserPermissionFromAll
Takes the permission back from every user that holds it as a grant of their own, as one change. A user who holds it through a group keeps it.- Parameters:
permission- The permission node.- Returns:
- the users the permission was taken from.
-