Skip to content

Permissions

endstone.permissions

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 Permissible

PermissionAttachment

Holds information about a permission attachment on a Permissible object

PermissionAttachmentInfo

Holds information on a permission and which PermissionAttachment provides it

PermissionDefault

Represents the possible default values for permissions

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.

remove_attachment

Removes a given PermissionAttachment.

Attributes:

Name Type Description
effective_permissions set[PermissionAttachmentInfo]

Gets effective permissions.

is_op bool

The operator status of this object

effective_permissions property

effective_permissions: set[PermissionAttachmentInfo]

Gets effective permissions.

is_op property writable

is_op: bool

The operator status of this object

add_attachment

add_attachment(
    plugin: Plugin, name: str, value: bool
) -> PermissionAttachment

Adds a new PermissionAttachment.

add_attachment(plugin: Plugin) -> PermissionAttachment

Adds a new PermissionAttachment.

has_permission

has_permission(name: str) -> bool

Checks if a permissions is available by name.

has_permission(perm: Permission) -> bool

Checks if a permissions is available by permission.

is_permission_set

is_permission_set(name: str) -> bool

Checks if a permissions is set by name.

is_permission_set(perm: Permission) -> bool

Checks if a permissions is set by permission.

recalculate_permissions

recalculate_permissions() -> None

Recalculates the permissions.

remove_attachment

remove_attachment(attachment: PermissionAttachment) -> None

Removes a given PermissionAttachment.

Permission

Permission(
    name: str,
    description: str | None = None,
    default: PermissionDefault | None = None,
    children: dict[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 Permissibles that contain this permission.

Attributes:

Name Type Description
children dict[str, bool]

Gets the children of this permission.

default PermissionDefault

The default value of this permission.

description str

The brief description of this permission

name str

Gets the unique fully qualified name of this Permission.

permissibles set[Permissible]

Gets a set containing every Permissible that has this permission.

children property

children: dict[str, bool]

Gets the children of this permission.

default property writable

The default value of this permission.

description property writable

description: str

The brief description of this permission

name property

name: str

Gets the unique fully qualified name of this Permission.

permissibles property

permissibles: set[Permissible]

Gets a set containing every Permissible that has this permission.

add_parent

add_parent(name: str, value: bool) -> Permission

Adds this permission to the specified parent permission.

add_parent(perm: Permission, value: bool) -> None

Adds this permission to the specified parent permission.

recalculate_permissibles

recalculate_permissibles() -> None

Recalculates all Permissibles that contain this permission.

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 Permissible.

set_permission
unset_permission

Attributes:

Name Type Description
permissible Permissible

Gets the Permissible that this is attached to.

permissions dict[str, bool]

Gets a copy of all set permissions and values contained within this attachment.

plugin Plugin

Gets the plugin responsible for this attachment.

removal_callback Callable[[PermissionAttachment], None]

The callback to be called when this attachment is removed.

permissible property

permissible: Permissible

Gets the Permissible that this is attached to.

permissions property

permissions: dict[str, bool]

Gets a copy of all set permissions and values contained within this attachment.

plugin property

plugin: Plugin

Gets the plugin responsible for this attachment.

removal_callback property writable

removal_callback: Callable[[PermissionAttachment], None]

The callback to be called when this attachment is removed.

remove

remove() -> bool

Removes this attachment from its registered Permissible.

set_permission

set_permission(name: str, value: bool) -> None

Sets a permission to the given value, by its fully qualified name.

set_permission(perm: Permission, value: bool) -> None

Sets a permission to the given value.

unset_permission

unset_permission(name: str) -> None

Removes the specified permission from this attachment by name.

unset_permission(perm: Permission) -> None

Removes the specified permission from this attachment.

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

Gets the attachment providing this permission.

permissible Permissible

Get the permissible this is attached to

permission str

Gets the permission being set

value bool

Gets the value of this permission

attachment property

Gets the attachment providing this permission.

permissible property

permissible: Permissible

Get the permissible this is attached to

permission property

permission: str

Gets the permission being set

value property

value: bool

Gets the value of this permission

PermissionDefault

PermissionDefault(value: int)

Represents the possible default values for permissions

Attributes:

Name Type Description
FALSE PermissionDefault
NOT_OP PermissionDefault
NOT_OPERATOR PermissionDefault
OP PermissionDefault
OPERATOR PermissionDefault
TRUE PermissionDefault
name str
value int

FALSE class-attribute

NOT_OP class-attribute

NOT_OPERATOR class-attribute

NOT_OPERATOR: PermissionDefault

OP class-attribute

OPERATOR class-attribute

TRUE class-attribute

name property

name: str

value property

value: int