## Replace who works on a posting (managers of the posting)

`PUT /api/hr/v1/recruiting/postings/{id}/access`

Module: HR · operationId: `setJobPostingAccess` · Tag: Recruiting · Auth: access token (`Authorization: Bearer <accessToken>`)

People, groups and org units (optionally with the units below them) as viewer, reviewer or manager. Heads and
deputies of the posting's org unit and the units above it are reviewers without an entry. Access lists only
apply to people signed in themselves; API keys act with their permissions.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes |  |

### Request body

`application/json` (required)

- `entries` (array of PostingAccessEntry): Who works on the posting; replaces the list
  - `role` (string, required): viewer reads; reviewer also notes, rates and sees interviews; manager moves, rejects, hires, mails, schedules and edits the posting (one of `viewer`, `reviewer`, `manager`)
  - `subjectId` (string (uuid), required): Id of the employee, group or org unit
  - `subjectKind` (string, required): Who is named: one employee, the members of a group or of an org unit (one of `employee`, `group`, `org_unit`)
  - `includeSubunits` (boolean): org_unit only: the members of the units below it too
  - `subjectName` (string, read-only): Name of the employee, group or org unit (filled on reads)

Example:

```json
{
  "entries": [
    {
      "role": "reviewer",
      "subjectId": "f2a4c6e8-0b2d-4f4a-8c6e-8a0c2e4b6d1c",
      "subjectKind": "employee"
    },
    {
      "includeSubunits": true,
      "role": "viewer",
      "subjectId": "2e4a6c8e-0a2c-4e4a-8c6e-0a2c4e6a8c72",
      "subjectKind": "org_unit"
    }
  ]
}
```

### Responses

- **200** The access list with names (`application/json`)
- **400** Error (`application/json`)
- **403** Error (`application/json`)
- **404** Error (`application/json`)

Fields of the 200 answer:

- `entries` (array of PostingAccessEntry): The saved access list
  - `role` (string, required): viewer reads; reviewer also notes, rates and sees interviews; manager moves, rejects, hires, mails, schedules and edits the posting (one of `viewer`, `reviewer`, `manager`)
  - `subjectId` (string (uuid), required): Id of the employee, group or org unit
  - `subjectKind` (string, required): Who is named: one employee, the members of a group or of an org unit (one of `employee`, `group`, `org_unit`)
  - `includeSubunits` (boolean): org_unit only: the members of the units below it too
  - `subjectName` (string, read-only): Name of the employee, group or org unit (filled on reads)

Example 200 answer:

```json
{
  "entries": [
    {
      "role": "reviewer",
      "subjectId": "f2a4c6e8-0b2d-4f4a-8c6e-8a0c2e4b6d1c",
      "subjectKind": "employee",
      "subjectName": "Jonas Bauer"
    },
    {
      "includeSubunits": true,
      "role": "viewer",
      "subjectId": "2e4a6c8e-0a2c-4e4a-8c6e-0a2c4e6a8c72",
      "subjectKind": "org_unit",
      "subjectName": "Technik"
    }
  ]
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/hr/v1/recruiting/postings/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12/access' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"entries":[{"role":"reviewer","subjectId":"f2a4c6e8-0b2d-4f4a-8c6e-8a0c2e4b6d1c","subjectKind":"employee"},{"includeSubunits":true,"role":"viewer","subjectId":"2e4a6c8e-0a2c-4e4a-8c6e-0a2c4e6a8c72","subjectKind":"org_unit"}]}'
```
