Interface PermissionTree
- All Known Subinterfaces:
MutablePermissionTree
public interface PermissionTree
A tree of permissions. A fancy radix tree if you will.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternRegex pattern used to validate permission strings. -
Method Summary
Modifier and TypeMethodDescriptionstatic PermissionTreeall()Returns an immutable permission tree with all permissions.static PermissionTreeempty()Returns an immutable empty permission tree.static PermissionTreefrom(PermissionTree tree) Creates an immutable permission tree with the given tree.getPermission(String permission) Get the permission state for a given permission.A flattened map of permissions.
-
Field Details
-
PERMISSION_PATTERN
Regex pattern used to validate permission strings.Notes:
Permission strings are composed of a series of nodes separated by dots with alphanumeric characters and minus signs, such as
"plugin.command".
A parent node is always overridden by a child node, such as"plugin.command"overriding"plugin".
Wildcards are also allowed, but they currently have the same effect as a normal node, such as"plugin.command.*"equals"plugin.command".
The only relevant use of wildcards is the root permission"*"permission. It allows you to set a default value for all permissions.
-
-
Method Details
-
empty
Returns an immutable empty permission tree. -
all
Returns an immutable permission tree with all permissions. -
from
Creates an immutable permission tree with the given tree.- Parameters:
tree- the tree- Returns:
- the immutable tree
-
getPermission
Get the permission state for a given permission.- Parameters:
permission- the permission- Returns:
- the permission state
-
getPermissions
A flattened map of permissions.
-