Permissions
endstone.permissions
¶
Classes relating to permissions of players.
Classes:
| Name | Description |
|---|---|
Permissible |
Represents an object that may become a server operator and can be assigned permissions. |
Permission |
Represents a unique permission that may be attached to a |
PermissionAttachment |
Holds information about a permission attachment on a |
PermissionAttachmentInfo |
Holds information on a permission and which |
PermissionDefault |
Represents the possible default values for permissions |
PermissionLevel |
|
Permissible
¶
Represents an object that may become a server operator and can be assigned permissions.
Methods:
| Name | Description |
|---|---|
add_attachment |
|
has_permission |
|
is_permission_set |
|
recalculate_permissions |
Recalculates the permissions for this object, if the attachments have changed values. |
remove_attachment |
Removes the given |
Attributes:
| Name | Type | Description |
|---|---|---|
effective_permissions |
set[PermissionAttachmentInfo]
|
A set containing all the permissions currently in effect by this object. |
permission_level |
PermissionLevel
|
The permission level of this object. |
effective_permissions
property
¶
effective_permissions: set[PermissionAttachmentInfo]
A set containing all the permissions currently in effect by this object.
add_attachment
¶
add_attachment(
plugin: Plugin, name: str, value: bool
) -> PermissionAttachment
add_attachment(plugin: Plugin) -> PermissionAttachment
recalculate_permissions
¶
Recalculates the permissions for this object, if the attachments have changed values.
This should very rarely need to be called from a plugin.
remove_attachment
¶
remove_attachment(attachment: PermissionAttachment) -> bool
Removes the given PermissionAttachment from this object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attachment
|
PermissionAttachment
|
Attachment to remove. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Permission
¶
Permission(
name: str,
description: str | None = None,
default: PermissionDefault | None = None,
children: Mapping[str, bool] | None = None,
*args,
**kwargs
)
Represents a unique permission that may be attached to a Permissible
Methods:
| Name | Description |
|---|---|
add_parent |
|
recalculate_permissibles |
Recalculates all |
Attributes:
| Name | Type | Description |
|---|---|---|
children |
dict[str, bool]
|
The children of this permission. |
default |
PermissionDefault
|
The default value of this permission. |
description |
str
|
A brief description of this permission. |
name |
str
|
The unique fully qualified name of this |
permissibles |
set[Permissible]
|
A set containing every |
children
property
¶
The children of this permission.
If you change this map in any form, you must call recalculate_permissibles() to recalculate all Permissibles.
permissibles
property
¶
permissibles: set[Permissible]
A set containing every Permissible that has this permission.
add_parent
¶
add_parent(name: str, value: bool) -> Permission
add_parent(perm: Permission, value: bool) -> None
recalculate_permissibles
¶
Recalculates all Permissibles that contain this permission.
This should be called after modifying the children, and is automatically called after modifying the default value.
PermissionAttachment
¶
PermissionAttachment(
plugin: Plugin, permissible: Permissible
)
Holds information about a permission attachment on a Permissible object.
Methods:
| Name | Description |
|---|---|
remove |
Removes this attachment from its registered |
set_permission |
|
unset_permission |
|
Attributes:
| Name | Type | Description |
|---|---|---|
permissible |
Permissible
|
The |
permissions |
dict[str, bool]
|
A copy of all set permissions and values contained within this attachment. |
plugin |
Plugin
|
The plugin responsible for this permission attachment. |
removal_callback |
Callable[[PermissionAttachment], None]
|
The callback to be called when this attachment is removed. May be empty. |
permissions
property
¶
A copy of all set permissions and values contained within this attachment.
This map may be modified but will not affect the attachment, as it is a copy.
removal_callback
property
writable
¶
removal_callback: Callable[[PermissionAttachment], None]
The callback to be called when this attachment is removed. May be empty.
remove
¶
remove() -> bool
Removes this attachment from its registered Permissible.
Returns:
| Type | Description |
|---|---|
bool
|
|
PermissionAttachmentInfo
¶
PermissionAttachmentInfo(
permissible: Permissible,
permission: str,
attachment: PermissionAttachment,
value: bool,
)
Holds information on a permission and which PermissionAttachment provides it.
Attributes:
| Name | Type | Description |
|---|---|---|
attachment |
PermissionAttachment
|
The attachment providing this permission. |
permissible |
Permissible
|
The |
permission |
str
|
The name of the permission being set. |
value |
bool
|
The value of this permission. |
attachment
property
¶
attachment: PermissionAttachment
The attachment providing this permission.
This may be None for default permissions (usually parent permissions).