diff --git a/openapi.yaml b/openapi.yaml
index b213fee..8f9556a 100644
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -32148,6 +32148,46 @@ components:
type: string
nullable: true
description: The Mailchimp list the Project's Contacts are added to
+ state_permissions:
+ type: array
+ description: >-
+ Who can give Contacts each status (Beneficiary State) switched on in the Project, set on Project
+ Preferences under each status as "Who can give contacts the ... status in this workspace?".
+ restricted false means Any colleague. When restricted is true, only organisation admins, leaders and
+ members of the listed Teams (team_ids), and managers and reporters of the listed workspaces
+ (project_ids) can give that status. In a request, send only the statuses to change. A restricted
+ status needs at least one Team or workspace from the Project's organisation, or the request is
+ refused with 422.
+ items:
+ type: object
+ required: [beneficiary_state_id]
+ properties:
+ beneficiary_state_id:
+ type: integer
+ description: The status, from beneficiary_states on GET /projects/{id}
+ name:
+ type: string
+ readOnly: true
+ description: The status's name, e.g. Enrolled or Waiting List
+ restricted:
+ type: boolean
+ description: false for Any colleague, true for only the Teams and workspaces listed
+ team_ids:
+ type: array
+ items:
+ type: integer
+ description: Teams whose leaders and members can give the status
+ project_ids:
+ type: array
+ items:
+ type: integer
+ description: Workspaces (Projects) whose managers and reporters can give the status
+ example:
+ - beneficiary_state_id: 1
+ name: Enrolled
+ restricted: true
+ team_ids: [12]
+ project_ids: []
ProjectTargets:
type: object
diff --git a/server.js b/server.js
index b7605a1..c17a367 100644
--- a/server.js
+++ b/server.js
@@ -1399,7 +1399,7 @@ function buildDocsPage() {
${endpointCard("GET", "/projects/{id}/preferences", "Get a Project's Project Preferences", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Project ID" }
], [
- { code: "200", cls: "response-2xx", desc: "The Project Preferences: Contact Forms and statuses (Waiting List, Enrolled, Alumni, Declined) with their forms and baseline Surveys, editorial control, Events, Cases, Timesheets, default Story privacy, the Mailchimp list, and the Region and Industry for localised Financial Values: the project's own region_factor_option_id and industry_factor_option_id (null to use the organisation's), and region and industry in effect, {id, name, source} with source project or organisation" },
+ { code: "200", cls: "response-2xx", desc: "The Project Preferences: Contact Forms and statuses (Waiting List, Enrolled, Alumni, Declined) with their forms and baseline Surveys, editorial control, Events, Cases, Timesheets, default Story privacy, the Mailchimp list, and the Region and Industry for localised Financial Values: the project's own region_factor_option_id and industry_factor_option_id (null to use the organisation's), and region and industry in effect, {id, name, source} with source project or organisation, and state_permissions: who can give Contacts each status, [{beneficiary_state_id, name, restricted, team_ids, project_ids}], where restricted: false means Any colleague" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "403", cls: "response-4xx", desc: "Not a Manager of the Project or an Organisation Admin (e.g. a Changemaker)" },
{ code: "404", cls: "response-4xx", desc: "Not found, or in an Organisation you don't work in" }
@@ -1413,7 +1413,7 @@ function buildDocsPage() {
{ code: "403", cls: "response-4xx", desc: "Not a Manager of the Project or an Organisation Admin" },
{ code: "404", cls: "response-4xx", desc: "Not found, or in an Organisation you don't work in" },
{ code: "422", cls: "response-4xx", desc: "{errors: [...]}" }
- ], "Saves what the Project Preferences page saves, with the same permissions. Only the settings you send change. Forms, Case Forms, Event Formats and Surveys must be the Project's Organisation's.")}
+ ], "Saves what the Project Preferences page saves, with the same permissions. Only the settings you send change. Forms, Case Forms, Event Formats and Surveys must be the Project's Organisation's. To choose who can give Contacts a status (\"Who can give contacts the Enrolled status in this workspace?\"), send state_permissions: [{beneficiary_state_id, restricted: true, team_ids, project_ids}] for each status to change: then only Organisation Admins, the leaders and members of those Teams, and the Managers and Reporters of those workspaces can give it. A restricted status needs at least one Team or workspace (422 otherwise); restricted: false returns it to Any colleague.")}
${endpointCard("GET", "/projects/{id}/targets", "Get a Project's targets", true, [
{ name: "id", in: "path", type: "integer", required: true, desc: "Project ID" }
], [