diff --git a/openapi.yaml b/openapi.yaml index e412f74..d7a63bd 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -575,6 +575,44 @@ paths: $ref: '#/components/responses/Unauthorized' "404": $ref: '#/components/responses/NotFound' + patch: + tags: [Charities] + summary: Change an Organisation's settings + description: | + Changes the Organisation's settings that Charity Preferences offers over the API. For now that is + **Default story level privacy setting on each project**: the Story Privacy Level each new project + in the Organisation starts with. Existing projects keep their own level, and each project's level + can still be changed on its Preferences page. Only settings sent are changed. Only an + Organisation Admin may do this; other colleagues get 403. Returns the Organisation. + operationId: updateCharity + security: [{tokenAuth: []}] + parameters: + - $ref: '#/components/parameters/ResourceId' + requestBody: + content: + application/json: + schema: + type: object + properties: + default_project_story_privacy: + $ref: '#/components/schemas/DefaultProjectStoryPrivacy' + example: + default_project_story_privacy: only_project_colleagues + responses: + "200": + description: The Organisation, with the setting changed + content: + application/json: + schema: + $ref: '#/components/schemas/Charity' + "401": + $ref: '#/components/responses/Unauthorized' + "403": + $ref: '#/components/responses/Forbidden' + "404": + $ref: '#/components/responses/NotFound' + "422": + $ref: '#/components/responses/UnprocessableEntity' /announcements: get: @@ -14783,6 +14821,18 @@ components: name: type: string example: "Greenfield Community Trust" + default_project_story_privacy: + $ref: '#/components/schemas/DefaultProjectStoryPrivacy' + + DefaultProjectStoryPrivacy: + type: string + description: | + The Story Privacy Level each new project in the Organisation starts with: Project colleagues + only, Organisation colleagues only, Network & organisation colleagues only, or Everyone. + Organisations created from November 2026 start with `only_project_colleagues`; older ones + with `only_charity_colleagues`. + enum: [only_project_colleagues, only_charity_colleagues, charity_plus_network, everyone] + example: only_project_colleagues ProjectDetail: description: A Project as returned by `GET /projects/{id}`. diff --git a/server.js b/server.js index e5e83e9..05bff69 100644 --- a/server.js +++ b/server.js @@ -1170,10 +1170,20 @@ function buildDocsPage() { ${endpointCard("GET", "/charities/{id}", "Get a single Organisation", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "Organisation ID" } ], [ - { code: "200", cls: "response-2xx", desc: "Charity record with id, name, timestamps" }, + { code: "200", cls: "response-2xx", desc: "Charity record with id, name, timestamps and default_project_story_privacy: the Story Privacy Level each new project in the Organisation starts with" }, { code: "401", cls: "response-4xx", desc: "Not authenticated" }, { code: "404", cls: "response-4xx", desc: "Not found" } ])} + ${endpointCard("PATCH", "/charities/{id}", "Change an Organisation's settings", true, [ + { name: "id", in: "path", type: "integer", required: true, desc: "Organisation ID" }, + { name: "default_project_story_privacy", in: "body", type: "string", required: false, desc: "Default story level privacy setting on each project: the Story Privacy Level each new project starts with. One of only_project_colleagues (Project colleagues only), only_charity_colleagues (Organisation colleagues only), charity_plus_network (Network & organisation colleagues only) or everyone. Existing projects keep their own level." } + ], [ + { code: "200", cls: "response-2xx", desc: "The Organisation, with the setting changed" }, + { code: "401", cls: "response-4xx", desc: "Not authenticated" }, + { code: "403", cls: "response-4xx", desc: "Not an Organisation Admin of this Organisation" }, + { code: "404", cls: "response-4xx", desc: "Not found, or not one of your Organisations" }, + { code: "422", cls: "response-4xx", desc: "default_project_story_privacy isn't one of the four levels" } + ], "Only an Organisation Admin can change these settings, the same people who can use Charity Preferences. Only the settings sent are changed.")}