Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,16 @@ paths:
post:
tags: [Projects]
summary: Add users to a Project
description: Grants roles on a Project. A user can hold Editor, Reporter, and Observer simultaneously.
description: |
Adds users to Projects' teams, as the Project's **Add Users** page does: as Project Managers (`editor_ids`),
Changemakers (`reporter_ids`) or Analysts (`observer_ids`). A user can hold more than one role.

You must be a Project Manager of every listed Project, or an Organisation Admin of its Organisation. The users
must already be colleagues in the Project's Organisation, unless the Organisation's preference "Allow Project
Managers to add Makerble Users outside the organisation to their project" is on.

The request is all or nothing: if any Project isn't found (404), isn't yours to manage (403) or any user can't
be added (422), nobody is added to any Project.
operationId: addColleague
security: [{tokenAuth: []}]
requestBody:
Expand Down Expand Up @@ -730,6 +739,10 @@ paths:
description: Users added
"401":
$ref: '#/components/responses/Unauthorized'
"403":
$ref: '#/components/responses/AddColleagueForbidden'
"404":
$ref: '#/components/responses/NotFound'
"422":
$ref: '#/components/responses/UnprocessableEntity'

Expand Down Expand Up @@ -7706,6 +7719,14 @@ components:
example:
success: false
errors: "Permission denied."
AddColleagueForbidden:
description: You aren't a Project Manager of one of the listed Projects or an Organisation Admin of its Organisation. Nobody is added to any of them.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "You don't have permission to add users to project 619."
UnprocessableEntity:
description: Validation failed
content:
Expand Down
6 changes: 4 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1176,8 +1176,10 @@ function buildDocsPage() {
${endpointCard("POST", "/projects/add_colleague.json", "Add users to a Project", true, [], [
{ code: "200", cls: "response-2xx", desc: "Users added successfully" },
{ code: "401", cls: "response-4xx", desc: "Not authenticated" },
{ code: "422", cls: "response-4xx", desc: "Validation failed" }
], "Grant one or more users a role on a Project. A user can hold Editor, Reporter, and Observer simultaneously. Pass user IDs in <code>role_data[].editor_ids</code>, <code>reporter_ids</code>, or <code>observer_ids</code>.")}
{ code: "403", cls: "response-4xx", desc: "Not a Project Manager of one of the Projects or an Organisation Admin of its Organisation (e.g. a Changemaker)" },
{ code: "404", cls: "response-4xx", desc: "A Project wasn't found" },
{ code: "422", cls: "response-4xx", desc: "A user can't be added: not a colleague in the Project's Organisation" }
], "Adds users to Projects' teams, as the Project's <b>Add Users</b> page does: as Project Managers (<code>role_data[].editor_ids</code>), Changemakers (<code>reporter_ids</code>) or Analysts (<code>observer_ids</code>). A user can hold more than one role. You must be a Project Manager of every listed Project or an Organisation Admin of its Organisation, and the users must already be colleagues in that Organisation unless its preference lets Project Managers add users from outside it. It's all or nothing: on any error nobody is added.")}
${endpointCard("GET", "/project_results", "Get Results Canvas figures for Projects", true, [
{ name: "project_ids", type: "integer[]", required: false, desc: "Projects to include, as <code>project_ids[]=619</code> or a JSON array string. Defaults to every Project you can view" },
{ name: "start_date", type: "string", required: false, desc: "First Story date to include, YYYY-MM-DD. Omit both dates for all time" },
Expand Down