public interface PermissionDescription
The description is meant to provide human readable descriptions and meta data for a permission.
Descriptions DO NOT have any impact on permission check, and are only provided and registered for an informational purpose.
Instances can be built using
PermissionService.newDescriptionBuilder(Object)
.
Modifier and Type | Interface and Description |
---|---|
static interface |
PermissionDescription.Builder
A builder for permission descriptions.
|
Modifier and Type | Field and Description |
---|---|
static String |
ROLE_ADMIN
The standard role for admins.
|
static String |
ROLE_STAFF
The standard role for staff.
|
static String |
ROLE_USER
The standard role for users.
|
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Map<SubjectReference,Boolean>> |
findAssignedSubjects(String collectionIdentifier)
Gets all subjects that have this permission set in the given collection.
|
Map<Subject,Boolean> |
getAssignedSubjects(String collectionIdentifier)
Gets all loaded subjects that have this permission set in the given
collection.
|
Optional<Text> |
getDescription()
Gets a short description of the linked permission.
|
String |
getId()
Gets the permission id this description belongs to.
|
Optional<PluginContainer> |
getOwner()
Gets the owning plugin the permission belongs to.
|
static final String ROLE_USER
The user role should be assigned to permissions where everyone should have basic access. For example: joining in an arena.
static final String ROLE_STAFF
The staff role should be assigned to permissions only meant for users with elevated access permissions. For example: force start an arena.
static final String ROLE_ADMIN
The admin role should be assigned to permissions only meant for users with full access to administrate the server. For example: setup an arena.
String getId()
The permission id must be of the specified format as specified using EBNF:
The following examples shall help you to structure your permissions well:
So if you want to allow someone to give themself only DIAMONDs, you would assign them the following permissions:
Note: Permission ids are case insensitive! Permission ids should start with the owning plugin's id.
Optional<Text> getDescription()
May include a link to a more detailed description on the plugin's web page.
Will return an empty optional for descriptions which have been
automatically generated, or where a description was omitted when the
PermissionDescription
was created.
Optional<PluginContainer> getOwner()
Will return an empty optional for descriptions which have been automatically generated.
CompletableFuture<Map<SubjectReference,Boolean>> findAssignedSubjects(String collectionIdentifier)
If you want to know to which role-templates this permission is
assigned, use PermissionService.SUBJECTS_ROLE_TEMPLATE
.
This method is equivalent to calling
SubjectCollection.getAllWithPermission(String)
for the given
collection, using getId()
as the permission.
collectionIdentifier
- The subject collection to querySubjectCollection.getAllWithPermission(String)
Map<Subject,Boolean> getAssignedSubjects(String collectionIdentifier)
If you want to know to which role-templates this permission is
assigned, use PermissionService.SUBJECTS_ROLE_TEMPLATE
.
This method is equivalent to calling
SubjectCollection.getLoadedWithPermission(String)
for the given
collection, using getId()
as the permission.
This method will return an empty map if the given collection is not loaded or does not exist.
collectionIdentifier
- The subject collection to querySubjectCollection.getLoadedWithPermission(String)