public static interface PermissionDescription.Builder
Modifier and Type | Method and Description |
---|---|
PermissionDescription.Builder |
assign(String role,
boolean value)
Assigns this permission to the given role-template
Subject . |
PermissionDescription.Builder |
description(Text description)
Sets the short description to use.
|
PermissionDescription.Builder |
id(String permissionId)
Sets the permission id for the description this builder creates.
|
PermissionDescription |
register()
Creates and registers a new
PermissionDescription instance
with the given settings. |
PermissionDescription.Builder id(String permissionId)
See PermissionDescription.getId()
for format
specifications.
permissionId
- The permission idPermissionDescription.Builder description(@Nullable Text description)
May include a link to a more detailed description on the plugin's web page.
Can be null if the permission does not have a description.
description
- The short description to usePermissionDescription.Builder assign(String role, boolean value)
Subject
.
If the given subject does not exist it will be created. Permission templates should not be assigned to regular subjects.
It is recommended to use the standard role suggestions expressed
as static parameters in PermissionDescription
.
Do not assign a permission to user, staff and admin at the same time but solve this with subject inheritance if possible.
Note: The permissions are only assigned during
register()
.
role
- The role-template to assign the permission to. See
constants in PermissionDescription
for common
roles (not exhaustive).value
- The value to to assignPermissionDescription register() throws IllegalStateException
PermissionDescription
instance
with the given settings.IllegalStateException
- If there are any settings left unset or
a description with the given permission id was already
registered and the PermissionService
does not support
overwriting descriptions