# Making and changing roles

The built-in roles cover the usual divisions of work. When none fits, such as a help desk that may reset passwords and nothing else, or a partner manager who may see jobs and not touch them, you make a role of your own. Roles are made in [Access Roles](Prefs-Access.md) of the Preferences. This page is about how to go about it; that page has every field.

## Before you make one

1. **Look at the built-in roles first.** There are 21, and two or three given together often do the job: User Manager and User Security Manager for a help desk, Job Editor and Job Integrator for somebody who builds jobs.
2. **Write down the task, not the person.** "Reset passwords for users of a group" is a role. "What Dana does" is not: Dana gets several roles.
3. **Decide the scope separately.** A role says *what*; *where* is set on each account that holds it.

## Start from a copy

The built-in roles cannot be changed. Select the one nearest to what you want and press **Copy**: you get a role of your own with the same grants and the id of the original with `-copy`. Give it an **Id**, a **Name** and a **Description** that say what it is for, then take grants out and put grants in.

**New** starts from nothing, for a role that is small.

## Grants

A grant is one permission, with the places it holds:

| In the grant | Choose |
|---|---|
| **Permission** | one entry of the server's list. The list is searchable; names read from the general to the specific, such as `users.user.password.reset`. |
| **Users**, **Jobs**, **Storage** | `managed` wherever the permission should follow the holder's own scope. `all` only where you mean all. Empty where the permission has nothing to do with it. |
| **Field keys** | for permissions about groups of user settings: which settings |
| **From addresses**, **Over protocols** | conditions: the grant counts only for requests from these addresses, or over these protocols |

`managed` is what makes one role serve many people. A role "Group Help Desk" with `users.user.password.reset` for `managed` users gives each holder that right for the group named on **their** account.

## Can give

**Can give** lists the roles a holder of this role may give to other accounts. Leave it empty unless holders shall appoint others. Nobody can give a role they could not be given themselves, and Administrator can never be put on this list.

## Three examples

**A help desk for one group.** Copy *User Security Manager*, remove everything but the reset of passwords and the clearing of a second factor, for `managed` users. Give it, together with *User Viewer*, to each help desk account, and set that account's users scope to its group.

**A job operator for one folder.** No new role is needed: give *Job Operator*, and set the account's jobs scope to `folder:Finance/`.

**An auditor from outside.** Give *Auditor* and *Log Reader*. Add the condition **From addresses** to a copy if they may only work from one place.

## Trying it

Save, give the role to a test account, and on that account's [Admin](Users-Admin.md) tab:

- read **Effective access**: is everything there that should be, and nothing else?
- ask **Test access** the questions that matter: "may this account reset the password of bob?", "of an administrator?"
- log in as the test account and look: it sees only the apps and the parts its roles reach.

## Changing a role later

A change holds at once for every account that has the role, and for their open sessions. So:

- **adding** a permission to a role gives it to all holders. Check who holds the role first.
- **removing** one may stop somebody's work, or a job they saved. The server tells you when accounts hold a role you are about to delete.
- prefer a **new** role for a new need over widening an old one.

A new version of the server may add permissions. They are never added to roles of your own; the built-in roles are brought up to date by the update. After an update, read the release notes for new permissions and decide which of your roles should have them.

## Where roles are kept

In the file `rbac.XML` in the server's folder. It belongs in every backup of the settings, and it is shared across a cluster with them.

## Things to avoid

- A role "Almost Administrator" with a long list of everything. Give Administrator, or decide what is really needed.
- `all` as a scope out of convenience.
- Roles per person. They multiply and nobody remembers what they were for.
- Giving the roles that touch identity (passwords, second factors, keys) together with roles that touch files or jobs, without a reason. Keep the two kinds of power with different people where you can.
