Access
: int
in package
One permission ladder for permission systems that agree on nothing.
Twitch has chat badges, Telegram has chat administrators and a creator, Discord has a role bitfield and a guild owner. An action declares the rung it needs, and each adapter is responsible for working out which rung the invoker stands on — see Context::$access.
The ladder is deliberately coarse, and it is the only one. Anything finer would have to be explained once per platform, and an action's author would have to know all of them; anything per-platform would mean a command's permissions changed depending on which chat it was typed in, which is how somebody ends up moderating a Twitch channel from a Telegram group they happen to be an admin of.
Tags
Table of Contents
Cases
- Administrator = 2
- The person whose room it is — the Twitch broadcaster, a Telegram chat's creator, a Discord guild's owner or an Administrator.
- Everyone = 0
- Anyone in chat.
- Moderator = 1
- Whoever the room trusts to police it: a Twitch moderator, a Telegram chat administrator, Discord's Manage Messages or above.
- Operator = 3
- Whoever runs the bot process. Not a chat role at all: it is configured in the environment, and it gates the things that can reach any endpoint or read back a secret.
Methods
- label() : string
- satisfies() : bool
- Whether standing on this rung is enough to run something needing `$required`.
Cases
Everyone
Anyone in chat.
Moderator
Whoever the room trusts to police it: a Twitch moderator, a Telegram chat administrator, Discord's Manage Messages or above.
Administrator
The person whose room it is — the Twitch broadcaster, a Telegram chat's creator, a Discord guild's owner or an Administrator.
This is the rung that may change what the room itself looks like, and the one that decides which Discord channel gets copied into a public chat.
Operator
Whoever runs the bot process. Not a chat role at all: it is configured in the environment, and it gates the things that can reach any endpoint or read back a secret.
Methods
label()
public
label() : string
Return values
stringsatisfies()
Whether standing on this rung is enough to run something needing `$required`.
public
satisfies(self $required) : bool
Parameters
- $required : self