# Members, roles and permissions

> How membership, roles, per-channel overrides and the management hierarchy work.

## Members

A member is a key, not an account. When you join with an invite, your client makes a
**member key** (a hybrid of ML-DSA-65 and Ed25519, safe against future quantum computers) and
registers it. Your display name is per community.

Membership has states: **pending** (waiting for approval, when the invite or community requires
it), **probation** (new members, with newcomer restrictions the community chooses), **active**,
**suspended**, **banned** and **left**.

## Roles

Each role has a name, a colour, a position and a set of permission
bits. Everyone has the implicit `@everyone` role. A member's permissions are the union of their
roles' bits, then adjusted per channel.

## Per-channel overrides

A channel can **allow** or **deny** bits for a role or a member, on top of the community-wide
roles. Categories can pass their overrides to synced channels.

## The hierarchy

Nobody can act above their own rank:

- you can only manage roles below your highest role;
- you can only kick, ban or time out members whose highest role is below yours;
- nobody can act on the owner;
- you can't grant a permission you don't have yourself (unless you are the owner or an
  administrator).

## Permission names

The same names appear in the Rust API (`Permissions::SEND_MESSAGES`), the JavaScript API
(`"SendMessages"`) and bot manifests (`SEND_MESSAGES`):

| Permission | Lets a member |
|---|---|
| `VIEW_CHANNEL` | see a channel and its messages |
| `SEND_MESSAGES` | post |
| `READ_MESSAGE_HISTORY` | read older messages |
| `MANAGE_MESSAGES` | delete others' messages |
| `ATTACH_FILES`, `EMBED_LINKS`, `ADD_REACTIONS`, `MENTION_EVERYONE` | as named |
| `MANAGE_CHANNELS`, `MANAGE_ROLES`, `MANAGE_COMMUNITY` | edit structure and settings |
| `CREATE_INVITE`, `MANAGE_INVITES` | invite, and manage everyone's invites |
| `KICK_MEMBERS`, `BAN_MEMBERS`, `TIMEOUT_MEMBERS` | moderate |
| `APPROVE_MEMBERS` | approve pending members |
| `VIEW_AUDIT_LOG`, `MANAGE_REPORTS`, `MANAGE_SAFETY` | read the audit log, handle reports, run lockdowns and admission policy |
| `CHANGE_NICKNAME`, `MANAGE_NICKNAMES` | rename yourself, or others |
| `BYPASS_SLOWMODE` | ignore a channel's slowmode |
| `CONNECT`, `SPEAK`, `MUTE_MEMBERS`, `DEAFEN_MEMBERS`, `MOVE_MEMBERS` | voice |
| `USE_APPLICATION_COMMANDS` | use bots' slash commands and components (on `@everyone` by default) |
| `ADMINISTRATOR` | everything, still within the hierarchy |

> **Note**
>
> Client libraries can check permissions locally (`member.can(...)` in Rust,
> `member.permissions(channel).has(...)` in JavaScript) to hide buttons a member can't use. The
> host always has the final say: it also applies lockdowns and newcomer rules the client can't see.
