> For the complete documentation index, see [llms.txt](https://wiki.datadike.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.datadike.com/sonar/administration/identities/roles.md).

# Roles and permissions

Build the roles that decide what each console user may do, give a role full access with Super User, and limit a role's devices to chosen clients and sites.

## What this is and when to use it

A role is a named set of permissions. Every console user holds one role, and the role decides which screens and actions the user has in the console. A role can also be limited to some clients or sites, which narrows the devices its users work with in the areas listed under **Client & Site Access** below.

Use roles to separate duties: a help desk role that can run scripts but not change settings, an auditor role that can only read, a technician role for one client. Create the role first, then assign users to it.

Roles live in **Admin Center › Roles**. The header menu **Management › Roles** opens the same screen.

## Before you start

* To open the screen: the **List Roles** permission.
* To create, edit, activate, deactivate or delete roles: **Manage Roles**.
* To add users to a role from this screen: **List Accounts**, so that the user search can list them.
* To pick allowed clients and sites: **List Clients** and **List Sites**.

## How a role decides access

| Setting                  | Effect                                                                                                                                    |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Permission toggles       | Each toggle grants one screen or action. The full list is in [Role permissions](https://wiki.datadike.com/sonar/reference/permissions.md) |
| **Super User**           | Grants every permission and ignores **Client & Site Access**. Reserve it for administrators                                               |
| **Client & Site Access** | Narrows the devices the role's users work with. See below                                                                                 |
| Active / inactive        | Users of an inactive role lose the permissions it grants until the role is active again                                                   |
| No role                  | A user without a role holds no permissions                                                                                                |

### Client & Site Access

**Allowed Clients** and **Allowed Sites** work together:

* Both empty: the role covers every client and site. The screen says `Empty means all clients are allowed` and `Empty means all sites are allowed`.
* **Allowed Clients** set: the role covers every site of those clients.
* **Allowed Sites** set: the role covers those sites. Their clients appear in the client tree with only the allowed sites.
* Both set: the role covers the union of the two.

The restriction applies to:

* the client overview and the device table in **Dashboard › Sysadmin**;
* opening a device, and these tabs and actions on it: edit, commands, scripts, reboot and shutdown, Wake-on-LAN, remote access, processes, services, event logs, software, updates, checks, tasks, notes, history and pending actions;
* bulk actions, which run only on the devices the role covers;
* the client and site tree, and editing clients and sites;
* deployments;
* alerts raised by devices;
* **Devices › Windows Updates**.

When a user whose role is limited to clients creates a client, the new client is added to the role's **Allowed Clients**. The same happens with sites and **Allowed Sites**.

## Steps

### Create a role

1. Open **Admin Center › Roles** and click **Create Role**.
2. In the header of the editor, type the role name where it says **New role name...**, and a **Description**.
3. Grant access in one of two ways:

   * tick **Super User** for full access, or
   * tick the permissions the role needs, group by group.

   Ticking **Super User** ticks every permission toggle with it.
4. Optional: under **Client & Site Access**, type in **Search and add clients...** or **Search and add sites...** and pick the clients or sites the role may work with.
5. Optional: under **Assigned Users**, type in **Search and add users...** and pick the users who get this role.
6. Click **Create Role**.

A user holds one role. Adding a user to **Assigned Users** moves them out of the role they had. Removing a user from **Assigned Users** leaves them with no role.

### Edit a role

1. Click the role in the list. The panel shows its **Assigned Users** and its enabled **Permissions**.
2. Click **Edit**, make the changes and click **Save Changes**.

Users who are signed in when a role changes see the new menus after they reload the console.

### Activate or deactivate a role

1. Click the role in the list.
2. Use the checkbox in the role's header. The list shows the role as **active** or **inactive**.

Deactivating a role withdraws its permissions from every user who holds it, without editing each user.

### Delete a role

1. Remove its users first, by editing the role or by moving each user to another role in **Admin Center › Users**. **Delete** stays unavailable while the role has users.
2. Click **Delete** and confirm in the **Delete role ...?** dialog.

## What you should see

The role appears in the list with its name, description, status (**active** or **inactive**) and two counters, for example `3 users` and `42 permissions`. The line above the list totals the roles and users. A message confirms each save: `Role created successfully.`, `Role updated successfully.`, `Role deactivated.` or `Role deleted successfully.`

## How to verify it worked

1. Click the role and check that **Permissions** lists exactly the permissions you intended and that the status shows **active**.
2. Open **Reports & Audits › Audits**, filter **Object** by **Role**, and find the **Add Object**, **Modify Object** or **Delete Object** entry with your username.
3. Open **Admin Center › Users** and confirm the **Role** column of each assigned user.
4. Sign in as a user of the role in a private browser window. Confirm that the screens the role grants are there and that a screen it does not grant is missing from the sidebar. Testing only what should work misses the permission that should not be there.
5. For a role limited by **Client & Site Access**, open **Dashboard › Sysadmin** as that user. The client list and the device table show only the allowed clients and sites.

## Common errors

| Symptom                                                  | Cause                                                                                      | Fix                                                                       |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
| **Create Role**, **Edit** and **Delete** are unavailable | Your role lacks **Manage Roles**                                                           | Ask an administrator to grant it                                          |
| **Delete** stays unavailable on a role                   | The role still has users                                                                   | Move its users to another role, then delete it                            |
| `name: role with this name already exists.`              | Role names are unique                                                                      | Choose another name                                                       |
| `name: This field may not be blank.`                     | The role has no name                                                                       | Type a name in the editor header                                          |
| The user search under **Assigned Users** finds nobody    | Your role lacks **List Accounts**                                                          | Grant **List Accounts**, or assign the role from **Admin Center › Users** |
| Users of a role suddenly have no access                  | The role is **inactive**                                                                   | Activate it with the checkbox in the role's header                        |
| A restricted user sees no devices at all                 | The allowed clients or sites have no devices, or the user's role grants no **List Agents** | Check **Client & Site Access** and the **Agents** permissions             |
| A user still sees an old menu after a role change        | The console loaded the permissions when the user signed in                                 | Reload the console                                                        |

## Field reference

| Field                         | What it does                                                                                                     | Accepted values                    | Default             |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ------------------- |
| Role name                     | Name shown in the role list and in the user form                                                                 | Text, unique, up to 255 characters | —                   |
| Description                   | Free text shown under the name in the list                                                                       | Text, up to 250 characters         | Empty               |
| Super User                    | Every permission, and no client or site restriction                                                              | Ticked / clear                     | Clear               |
| Permission toggles            | One permission each, in groups. See [Role permissions](https://wiki.datadike.com/sonar/reference/permissions.md) | Ticked / clear                     | Clear               |
| Allowed Clients               | Clients whose devices the role covers                                                                            | Any client                         | Empty (all clients) |
| Allowed Sites                 | Sites whose devices the role covers                                                                              | Any site                           | Empty (all sites)   |
| Assigned Users                | Users who hold this role                                                                                         | Any console user                   | Empty               |
| Active checkbox (role header) | Whether the role's users have their permissions                                                                  | Ticked / clear                     | Ticked              |

## Related pages

* [Role permissions](https://wiki.datadike.com/sonar/reference/permissions.md) — every toggle and what it allows
* [Users](https://wiki.datadike.com/sonar/administration/identities/users.md) — create users and give them a role
* [Clients and sites](https://wiki.datadike.com/sonar/administration/devices/clients-and-sites.md) — what **Client & Site Access** points at
* [Audit trail](https://wiki.datadike.com/sonar/administration/audit/audit-trail.md) — where role changes are recorded
