# Separation of duties and approvals

> Make sure nobody approves, issues or closes their own work: restrictions that cover admins, the approval:decide action and forbidding a move into one state.

Source: https://docs.ligament.ai/guides/access/separation-of-duties/

Separation of duties means one person can’t do every step of a sensitive process alone: the person who asks for a change doesn’t approve it, the person who requests equipment doesn’t hand it out to themselves. Use this page to set that up with restrictions. You need to be a workspace owner or admin.

Three things make it work:

| Tool | What it does |
| --- | --- |
| A restriction **enforced on owners and admins too** | Owners and admins normally skip every rule. A restriction with this switch on stops them as well, so the rule has no back door. |
| `transition:<state>` | A restriction can forbid moving a record into one state, such as `transition:on_loan` or `transition:implementing`, instead of every state change. |
| `approval:decide` | A record action. Grant it to the people who may decide approvals on an entity, and forbid it with a restriction where they mustn’t. |

## Nobody hands out equipment they requested

In Northwind Group, equipment loans go from Requested to On loan to Returned. This restriction stops the person who created a loan from moving it to On loan:

```json
{
  "key": "equipment_loan.no_self_issue",
  "entity": "equipment_loan",
  "actions": ["transition:on_loan"],
  "forbidWhen": { "left": "{{createdBy}}", "op": "eq", "right": "@me" },
  "enforceOnAdmins": true,
  "message": "Someone else hands out equipment you requested."
}
```

To make it in the app:

1.  On the Restrictions tab, click **New restriction**.
2.  Choose the entity, Equipment loan. Under **Forbidden actions › Moving into a state**, tick **Move to On loan**.
3.  Under **When**, add the condition **Created by** is **me**.
4.  Under **Who it covers**, leave the roles empty (everyone) and tick **Enforce on owners and admins too**.
5.  Write the message, then **Plan** and **Apply**.

\[Screenshot: The restriction equipment\_loan.no\_self\_issue: forbids moving to On loan when Created by is me, for everyone, owners and admins included\]

With it applied, Ada (the workspace owner) created a loan for a Dell 27-inch monitor and tried to move it to On loan. The answer was:

```json
{
  "error": "Someone else hands out equipment you requested.",
  "code": "forbidden",
  "fix": "Restrictions always win over grants; restriction \"equipment_loan.no_self_issue\" covers this record."
}
```

Loans someone else created aren’t covered by the condition, so whoever may change a loan’s state can still move those to On loan.

## Nobody approves their own request

Approvals on a record (a change waiting for approval, a leave request) are decided by the approver. Two rules decide who that may be:

-   **Who may decide.** Grant the record action `approval:decide` on the entity in the approvers’ permission set, with a row condition if only some records are theirs, for example “leave requests of people below me, at most two levels down”. Once any set grants `approval:decide` on an entity, only those grants (and owners and admins) count: being the approval’s assignee is no longer enough on its own. While no set grants it, the assignee or a workspace admin decides, as before.
-   **Who may not.** A restriction that forbids `approval:decide` when the record was requested by the decider, enforced on owners and admins:

```json
{
  "key": "change.no_self_approval",
  "entity": "change",
  "actions": ["approval:decide", "transition:implementing"],
  "forbidWhen": { "left": "{{createdBy}}", "op": "eq", "right": "@me" },
  "enforceOnAdmins": true,
  "message": "You can't approve or implement a change you requested."
}
```

The check runs however the approval is decided: in the app, with an API key (the key’s creator decides) or from an approval email link (the member with that email decides; an email that isn’t a member can’t decide an approval on such a record).

\[Screenshot: The restriction editor for a new restriction on Change: Decide approvals and Move to Implementing are ticked, owners and admins are covered, and holders of change.emergency are exempt\]

## Exceptions

-   **A capability exemption.** Set **Except holders of capability** on the restriction, for example `change.emergency`, and give that capability (in a permission set) to the few people allowed to break the rule. Everyone else, admins included, stays covered.
-   **Overrides restrictions.** A role with **Overrides restrictions** isn’t stopped by restrictions enforced on admins. Combine it with [break-glass](https://docs.ligament.ai/guides/access/time-bound-access/index.md) so it’s only active for a few hours and every use is in the audit.

## Check it

-   **More actions › Why can I see this?** on a record shows the restriction that refuses you, with its message.
-   The entity’s page under **Settings › Access › Entities** shows the restriction next to every role it covers.
-   Before applying, **Plan** shows who would lose which action (see [Reviewing access changes](https://docs.ligament.ai/guides/access/reviewing-access-changes/index.md)).

The [HR example](https://docs.ligament.ai/guides/access/hr-example/index.md) uses the same pattern for leave requests: managers approve their reports’ leave, nobody approves their own.
