# Roles and permissions

> Roles decide what each person and agent can do in a Vigil organization. Vigil has six default roles, from guard to owner, and you can create your own.

Source: https://vigilsecure.net/docs/concepts/roles/

A role is a named set of permissions. You give roles to
[users](https://vigilsecure.net/docs/concepts/users.md) and to [agents](https://vigilsecure.net/docs/concepts/agents.md), and the roles add up
to what each one can see and do in your organization.

You find them under **Directory → Roles** in the console. Choose a role to see everything
it allows and who holds it.

## Default roles

Every organization has these six roles. They cannot be changed or deleted.

| Role           | Made for                                         | In short                                                                                      |
| -------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------- |
| **guard**      | People working on a device in the field          | Reads sites, beacons, devices, people and agents; starts chats                                |
| **supervisor** | Shift and site supervisors                       | Everything a guard can, plus managing sites and beacons and reading artifacts                 |
| **operator**   | The control room                                 | Plus inviting and removing people, linking devices and gateways, and managing chats           |
| **manager**    | Operations managers                              | Plus creating and editing agents and skills, and publishing and sharing artifacts             |
| **admin**      | Administrators                                   | Plus creating roles, reading agent runs, seeing device locations, and sending device commands |
| **owner**      | The people accountable for the company's account | Everything, including editing and deleting the organization                                   |

Each role includes everything the role above it in the table can do.

### What each default role can do

| Area                                                                         | guard | supervisor | operator | manager | admin | owner |
| ---------------------------------------------------------------------------- | ----- | ---------- | -------- | ------- | ----- | ----- |
| View people, roles, agents and skills                                        | Yes   | Yes        | Yes      | Yes     | Yes   | Yes   |
| View sites, beacons and devices                                              | Yes   | Yes        | Yes      | Yes     | Yes   | Yes   |
| Start chats                                                                  | Yes   | Yes        | Yes      | Yes     | Yes   | Yes   |
| Create, edit and archive sites and beacons                                   |       | Yes        | Yes      | Yes     | Yes   | Yes   |
| View artifacts                                                               |       | Yes        | Yes      | Yes     | Yes   | Yes   |
| Invite people, change their roles, remove them                               |       |            | Yes      | Yes     | Yes   | Yes   |
| Link and rename devices; link camera gateways                                |       |            | Yes      | Yes     | Yes   | Yes   |
| Manage chats they are in without being an owner, and moderate messages there |       |            | Yes      | Yes     | Yes   | Yes   |
| Create, edit and remove agents and skills                                    |       |            |          | Yes     | Yes   | Yes   |
| Publish, edit, archive and share artifacts                                   |       |            |          | Yes     | Yes   | Yes   |
| Create, edit and delete roles                                                |       |            |          |         | Yes   | Yes   |
| View agent runs and agent spend                                              |       |            |          |         | Yes   | Yes   |
| See device locations, battery and signal                                     |       |            |          |         | Yes   | Yes   |
| Send device commands; unlink devices                                         |       |            |          |         | Yes   | Yes   |
| Edit or delete the organization                                              |       |            |          |         |       | Yes   |
| Send email from the organization                                             |       |            |          |         |       | Yes   |

The person who creates an organization is its first owner.

## Custom roles

When the default roles do not fit, create your own. A common case is a control room
operator who also needs to see device locations, without the rest of what an admin can do.

1. Choose **Directory → Roles**, then **New role**.
2. Enter a **Role name**, such as `Control room`. Under **Start from**, choose **Blank** or
   an existing role to copy its permissions.
3. Tick the **Permissions** the role should have. Choose **Details** to read what each one
   allows.
4. Review and choose **Create role**.

You can edit, duplicate and delete custom roles. A change applies to everyone who holds the
role. A role cannot be deleted while a person, an agent or a pending invitation still uses
it.

Creating and editing roles needs the admin or owner role, and you can only put permissions
in a role that you hold yourself.

## Permissions

Permissions are grouped the way the console shows them.

### People and access

| Permission                          | Allows                                                    |
| ----------------------------------- | --------------------------------------------------------- |
| Send invitations                    | Invite people by email, phone number or a single-use link |
| Cancel invitations                  | Withdraw an invitation                                    |
| View members                        | See the organization's members and their roles            |
| Change member roles                 | Change the roles a member holds                           |
| Remove members                      | Remove people from the organization                       |
| View, create, edit and delete roles | Manage roles, limited to permissions you hold             |

### Operations

| Permission                                       | Allows                                                                                                                                |
| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| View, create, edit and remove agents             | Manage agents, their instructions and their roles                                                                                     |
| View agent runs                                  | See each time an agent ran, what woke it, what it did, and what agents cost. This includes the content of chats the viewer is not in. |
| View, write, edit and archive agent skills       | Manage your organization's skills                                                                                                     |
| View, create, edit and archive sites             | Manage sites                                                                                                                          |
| View, register, edit, assign and archive beacons | Manage beacons and move them between sites                                                                                            |
| View devices                                     | See the devices linked to the organization                                                                                            |
| Link, rename and unlink devices                  | Bring devices in, name them and release them                                                                                          |
| Send device commands                             | Send a device a command, such as a sign-in request                                                                                    |
| See device locations                             | See where devices are on the map, their battery and signal, and which are near a site                                                 |
| Link gateways                                    | Link a camera gateway                                                                                                                 |

### Communication

| Permission                | Allows                                                                                   |
| ------------------------- | ---------------------------------------------------------------------------------------- |
| Create channels           | Start a chat                                                                             |
| Edit and archive channels | Rename or close a group without being its owner                                          |
| Manage channel members    | Add and remove members of a group without being its owner                                |
| Moderate messages         | Take down another person's message                                                       |
| Send emails               | Send email from the organization to any address, once Vigil has switched email on for it |

### Artifacts

| Permission                          | Allows                                                                |
| ----------------------------------- | --------------------------------------------------------------------- |
| View artifacts                      | Open the organization's artifacts                                     |
| Publish, edit and archive artifacts | Manage artifacts                                                      |
| Share artifacts by public link      | Create and revoke links that let anyone holding them open an artifact |

### Organization

| Permission           | Allows                                                   |
| -------------------- | -------------------------------------------------------- |
| Edit organization    | Change the name, logo, website, address and company size |
| Archive organization | Delete the organization for everybody                    |

## How permissions are applied

- A person or agent with several roles has every permission in any of them.
- Permissions apply inside one organization. Somebody who is an owner in one company has no
  access to another unless they are a member there too.
- Chats have their own access. Being an owner does not let you read a chat you are not in,
  and the chat permissions apply only to chats you are in.
- An [access token](https://vigilsecure.net/docs/setup/use-vigil-with-ai.md#step-1-create-an-access-token), the key an AI assistant or other software uses, has exactly
  the permissions of the person who created it.
- Nobody can give away more than they have. This holds for invitations, role changes and
  custom roles.

## Related

- [Users](https://vigilsecure.net/docs/concepts/users.md)
- [Agents](https://vigilsecure.net/docs/concepts/agents.md)
- [Frequently asked questions](https://vigilsecure.net/docs/faq.md#people-and-roles)
