# Roles and permissions

Source: https://docs.gryt.chat/docs/use/roles

What people are allowed to do on your server, and how to decide it

A role is two things: a set of **permissions**, which is what somebody may do,
and a **rank**, which is who they may act on. They answer different questions
and are worth keeping apart in your head — a rank-90 auditor holding nothing but
*view audit log* outranks your moderators without gaining any of their powers.

Every server starts with five roles. You can rename them, recolour them, change
what they hold, and add your own.

| | Rank | Roughly |
|---|---|---|
| Owner | 100 | Everything. Can't be edited or handed out. |
| Admin | 80 | Everything except roles, server settings and identity replacement. |
| Moderator | 60 | Kick, mute, deafen, pull people out of voice. |
| Member | 40 | Talk, upload, join voice, change their own name. |
| Guest | 10 | Read, and nothing else. |

## Reading is a permission

This is the part that surprises people. *Read messages* is something a role can
lack, and a role without it's somebody who is in your server and can't see it.

That's what makes a genuinely read-only tier possible — and it's why the Guest
role isn't empty. A read-only role that can't read isn't read-only.

## Who can start a call

Ringing somebody in a direct message is *start calls*. Answering is *join
voice*, the same permission as walking into a voice channel.

Keeping them apart is what lets you limit who places a call without stopping
anyone picking one up. A role with *join voice* and no *start calls* can be
rung by anybody and can answer; it just has no call button of its own. That's
the shape behind "only paying members start calls". One permission covering
both would leave somebody unable to answer a call placed to them.

Every role that could already call keeps it when you upgrade, so nothing stops
working the day you take the update. Take it off the roles you want to
restrict.

## Who gets what when they join

**Server settings → Role editor → When somebody joins.**

Two settings, not one, and the split is the point:

- **With an account** — a durable identity, vouched for by a certificate
  authority. Losing a device doesn't lose it.
- **As a guest** — a key generated in the browser. Anybody can throw one away
  and mint another in about two seconds.

A public server usually wants accounts on `Member` and guests on `Guest`: come
in, read everything, and make an account if you want to talk. That combination
isn't expressible with a single default, which is why there are two.

<Callout title="Guests only reach your server if you let them">
Whether a server accepts keys-without-accounts at all is `GRYT_IDENTITY_TIERS`
on the server, and it doesn't include them by default. Where it doesn't, the
guest default is never used.
</Callout>

Changing a default only affects people who arrive afterwards. It never re-sorts
the members you already have.

## Roles that hand themselves out

A role can say what it asks of somebody before it grants itself: days since they
joined, messages they have sent, or both.

Fill in **both** and it means both — a fortnight *and* fifty messages. Time on
its own is something a patient stranger also has, and it's exactly what
somebody planning to abuse a server would wait out.

It only ever promotes. Nobody is moved down for going quiet, and anybody already
holding a higher role stays where they are. It's checked when somebody joins
and after they post, so a role earned while they were away arrives the next time
they turn up.

Built-in roles don't offer this. A server that wants an automatic tier wants a
new role for it, rather than `Moderator` quietly acquiring people.

## Rank, and who can act on whom

Kicks, bans, mutes and role changes all refuse against an **equal or higher**
rank. One admin can't kick another; only the owner can act on an admin.

The same rule applies to handing roles out. You can't grant a role at or above
your own rank, and you can't put a permission into a role that you don't hold
yourself — otherwise delegating *manage roles* would be delegating everything.

## A worked example

Say you're running a public support server.

1. **Guests read.** Set the guest joining default to `Guest`. People can turn up
   with no account and read every answer already given.
2. **Accounts talk.** Set the account default to `Member`, then take
   *attach files* and *join voice* off it. New accounts can ask questions;
   nothing else.
3. **Regulars get more.** Make a `Regular` role at rank 45 with *attach files*
   and *join voice*, and have it grant itself after 14 days and 50 messages.
4. **Helpers moderate.** Make a `Helper` role at rank 50 with *manage messages*
   and *kick members*, and hand it out yourself.

Nobody has to watch the door, and the only thing you decide by hand is who
becomes a Helper.
