From b7a3476ef51899c5e4f0524d3926960afca57bfa Mon Sep 17 00:00:00 2001 From: Daan Rosendal Date: Sat, 4 Nov 2023 16:00:39 +0100 Subject: [PATCH 1/6] feat(openapi): add endpoint to share workflows (#429) Adds `reana-server` and `reana-workflow-controller` OpenAPI specifications for sharing a workflow with a user. Closes reanahub/reana-client#680 --- AUTHORS.md | 1 + .../openapi_specifications/reana_server.json | 191 ++++++++++++++++++ .../reana_workflow_controller.json | 191 ++++++++++++++++++ 3 files changed, 383 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index 373cd589..b4f51d10 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -9,6 +9,7 @@ The list of contributors in alphabetical order: - [Burt Holzman](https://orcid.org/0000-0001-5235-6314) - [Camila Diaz](https://orcid.org/0000-0001-5543-797X) - [Clemens Lange](https://orcid.org/0000-0002-3632-3157) +- [Daan Rosendal](https://orcid.org/0000-0002-3447-9000) - [Daniel Prelipcean](https://orcid.org/0000-0002-4855-194X) - [Diego Rodriguez](https://orcid.org/0000-0003-0649-2002) - [Dinos Kousidis](https://orcid.org/0000-0002-4914-4289) diff --git a/reana_commons/openapi_specifications/reana_server.json b/reana_commons/openapi_specifications/reana_server.json index 3001071d..4db3989b 100644 --- a/reana_commons/openapi_specifications/reana_server.json +++ b/reana_commons/openapi_specifications/reana_server.json @@ -2972,6 +2972,197 @@ "summary": "Get the retention rules of a workflow." } }, + "/api/workflows/{workflow_id_or_name}/share": { + "post": { + "description": "This resource shares a workflow with another user. This resource is expecting a workflow UUID and some parameters.", + "operationId": "share_workflow", + "parameters": [ + { + "description": "The API access_token of workflow owner.", + "in": "query", + "name": "access_token", + "required": false, + "type": "string" + }, + { + "description": "Required. Workflow UUID or name.", + "in": "path", + "name": "workflow_id_or_name", + "required": true, + "type": "string" + }, + { + "description": "Required. User to share the workflow with.", + "in": "query", + "name": "user_email_to_share_with", + "required": true, + "type": "string" + }, + { + "description": "Optional. Message to include when sharing the workflow.", + "in": "query", + "name": "message", + "required": false, + "type": "string" + }, + { + "description": "Optional. Date when access to the workflow will expire (format YYYY-MM-DD).", + "in": "query", + "name": "valid_until", + "required": false, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Request succeeded. The workflow has been shared with the user.", + "examples": { + "application/json": { + "message": "The workflow has been shared with the user.", + "workflow_id": "cdcf48b1-c2f3-4693-8230-b066e088c6ac", + "workflow_name": "mytest.1" + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + }, + "workflow_id": { + "type": "string" + }, + "workflow_name": { + "type": "string" + } + }, + "type": "object" + } + }, + "400": { + "description": "Request failed. The incoming data specification seems malformed.", + "examples": { + "application/json": { + "errors": [ + "Missing data for required field." + ], + "message": "Malformed request." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "403": { + "description": "Request failed. User is not allowed to share the workflow.", + "examples": { + "application/json": { + "errors": [ + "User is not allowed to share the workflow." + ] + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "404": { + "description": "Request failed. Workflow does not exist or user does not exist.", + "examples": { + "application/json": { + "errors": [ + "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" + ], + "message": "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "409": { + "description": "Request failed. The workflow is already shared with the user.", + "examples": { + "application/json": { + "errors": [ + "The workflow is already shared with the user." + ], + "message": "The workflow is already shared with the user." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "500": { + "description": "Request failed. Internal controller error.", + "examples": { + "application/json": { + "errors": [ + "Internal controller error." + ], + "message": "Internal controller error." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + } + }, + "summary": "Share a workflow with another user." + } + }, "/api/workflows/{workflow_id_or_name}/specification": { "get": { "description": "This resource returns the REANA workflow specification used to start the workflow run. Resource is expecting a workflow UUID.", diff --git a/reana_commons/openapi_specifications/reana_workflow_controller.json b/reana_commons/openapi_specifications/reana_workflow_controller.json index 8fa267f5..ba596536 100644 --- a/reana_commons/openapi_specifications/reana_workflow_controller.json +++ b/reana_commons/openapi_specifications/reana_workflow_controller.json @@ -993,6 +993,197 @@ "summary": "Get the retention rules of a workflow." } }, + "/api/workflows/{workflow_id_or_name}/share": { + "post": { + "description": "This resource allows to share a workflow with other users.", + "operationId": "share_workflow", + "parameters": [ + { + "description": "Required. UUID of workflow owner.", + "in": "query", + "name": "user_id", + "required": true, + "type": "string" + }, + { + "description": "Required. Analysis UUID or name.", + "in": "path", + "name": "workflow_id_or_name", + "required": true, + "type": "string" + }, + { + "description": "Required. User to share the workflow with.", + "in": "query", + "name": "user_email_to_share_with", + "required": true, + "type": "string" + }, + { + "description": "Optional. Message to include when sharing the workflow.", + "in": "query", + "name": "message", + "required": false, + "type": "string" + }, + { + "description": "Optional. Date when access to the workflow will expire (format YYYY-MM-DD).", + "in": "query", + "name": "valid_until", + "required": false, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Request succeeded. The workflow has been shared with the user.", + "examples": { + "application/json": { + "message": "The workflow has been shared with the user.", + "workflow_id": "cdcf48b1-c2f3-4693-8230-b066e088c6ac", + "workflow_name": "mytest.1" + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + }, + "workflow_id": { + "type": "string" + }, + "workflow_name": { + "type": "string" + } + }, + "type": "object" + } + }, + "400": { + "description": "Request failed. The incoming data specification seems malformed.", + "examples": { + "application/json": { + "errors": [ + "Missing data for required field." + ], + "message": "Malformed request." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "403": { + "description": "Request failed. User is not allowed to share the workflow.", + "examples": { + "application/json": { + "errors": [ + "User is not allowed to share the workflow." + ] + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "404": { + "description": "Request failed. Workflow does not exist or user does not exist.", + "examples": { + "application/json": { + "errors": [ + "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" + ], + "message": "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "409": { + "description": "Request failed. The workflow is already shared with the user.", + "examples": { + "application/json": { + "errors": [ + "The workflow is already shared with the user." + ], + "message": "The workflow is already shared with the user." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "500": { + "description": "Request failed. Internal controller error.", + "examples": { + "application/json": { + "errors": [ + "Internal controller error." + ], + "message": "Internal controller error." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + } + }, + "summary": "Share a workflow with other users." + } + }, "/api/workflows/{workflow_id_or_name}/status": { "get": { "description": "This resource reports the status of workflow.", From 2ec60cc4c92006855db86173d749a65eb8d39e32 Mon Sep 17 00:00:00 2001 From: Daan Rosendal Date: Wed, 8 Nov 2023 23:31:31 +0100 Subject: [PATCH 2/6] feat(openapi): add endpoint to unshare workflows (#429) Adds `reana-server` and `reana-workflow-controller` OpenAPI specifications for unsharing a workflow. Closes reanahub/reana-client#681 --- .../openapi_specifications/reana_server.json | 185 +++++++++++++++++- .../reana_workflow_controller.json | 179 ++++++++++++++++- 2 files changed, 362 insertions(+), 2 deletions(-) diff --git a/reana_commons/openapi_specifications/reana_server.json b/reana_commons/openapi_specifications/reana_server.json index 4db3989b..4a32e68f 100644 --- a/reana_commons/openapi_specifications/reana_server.json +++ b/reana_commons/openapi_specifications/reana_server.json @@ -2,7 +2,7 @@ "info": { "description": "Submit workflows to be run on REANA Cloud", "title": "REANA Server", - "version": "0.9.1a3" + "version": "0.9.1" }, "paths": { "/account/settings/linkedaccounts/": {}, @@ -3955,6 +3955,189 @@ "summary": "Set status of a workflow." } }, + "/api/workflows/{workflow_id_or_name}/unshare": { + "post": { + "description": "This resource unshares a workflow with another user. This resource is expecting a workflow UUID and some parameters.", + "operationId": "unshare_workflow", + "parameters": [ + { + "description": "The API access_token of workflow owner.", + "in": "query", + "name": "access_token", + "required": false, + "type": "string" + }, + { + "description": "Required. Workflow UUID or name.", + "in": "path", + "name": "workflow_id_or_name", + "required": true, + "type": "string" + }, + { + "description": "Required. User to unshare the workflow with.", + "in": "query", + "name": "user_email_to_unshare_with", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Request succeeded. The workflow has been unshared with the user.", + "examples": { + "application/json": { + "message": "The workflow has been unshared with the user.", + "workflow_id": "cdcf48b1-c2f3-4693-8230-b066e088c6ac", + "workflow_name": "mytest.1" + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + }, + "workflow_id": { + "type": "string" + }, + "workflow_name": { + "type": "string" + } + }, + "type": "object" + } + }, + "400": { + "description": "Request failed. The incoming data specification seems malformed.", + "examples": { + "application/json": { + "errors": [ + "Missing data for required field." + ], + "message": "Malformed request." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "403": { + "description": "Request failed. User is not allowed to unshare the workflow.", + "examples": { + "application/json": { + "errors": [ + "User is not allowed to unshare the workflow." + ] + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "404": { + "description": "Request failed. Workflow does not exist or user does not exist.", + "examples": { + "application/json": { + "errors": [ + "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" + ], + "message": "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "409": { + "description": "Request failed. The workflow is not shared with the user.", + "examples": { + "application/json": { + "errors": [ + "The workflow is not shared with the user." + ], + "message": "The workflow is not shared with the user." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "500": { + "description": "Request failed. Internal controller error.", + "examples": { + "application/json": { + "errors": [ + "Internal controller error." + ], + "message": "Internal controller error." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + } + }, + "summary": "Unshare a workflow with another user." + } + }, "/api/workflows/{workflow_id_or_name}/workspace": { "get": { "description": "This resource retrieves the file list of a workspace, given its workflow UUID.", diff --git a/reana_commons/openapi_specifications/reana_workflow_controller.json b/reana_commons/openapi_specifications/reana_workflow_controller.json index ba596536..f66dce6b 100644 --- a/reana_commons/openapi_specifications/reana_workflow_controller.json +++ b/reana_commons/openapi_specifications/reana_workflow_controller.json @@ -2,7 +2,7 @@ "info": { "description": "Submit and manage workflows", "title": "REANA Workflow Controller", - "version": "0.9.1a2" + "version": "0.9.1" }, "paths": { "/api/workflows": { @@ -1418,6 +1418,183 @@ "summary": "Set workflow status." } }, + "/api/workflows/{workflow_id_or_name}/unshare": { + "post": { + "description": "This resource allows to unshare a workflow with other users.", + "operationId": "unshare_workflow", + "parameters": [ + { + "description": "Required. UUID of workflow owner.", + "in": "query", + "name": "user_id", + "required": true, + "type": "string" + }, + { + "description": "Required. Analysis UUID or name.", + "in": "path", + "name": "workflow_id_or_name", + "required": true, + "type": "string" + }, + { + "description": "Required. User to unshare the workflow with.", + "in": "query", + "name": "user_email_to_unshare_with", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Request succeeded. The workflow has been unshared with the user.", + "examples": { + "application/json": { + "message": "The workflow has been unsahred with the user.", + "workflow_id": "cdcf48b1-c2f3-4693-8230-b066e088c6ac", + "workflow_name": "mytest.1" + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + }, + "workflow_id": { + "type": "string" + }, + "workflow_name": { + "type": "string" + } + }, + "type": "object" + } + }, + "400": { + "description": "Request failed. The incoming data specification seems malformed.", + "examples": { + "application/json": { + "errors": [ + "Missing data for required field." + ], + "message": "Malformed request." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "403": { + "description": "Request failed. User is not allowed to unshare the workflow.", + "examples": { + "application/json": { + "errors": [ + "User is not allowed to unshare the workflow." + ] + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "404": { + "description": "Request failed. Workflow does not exist or user does not exist.", + "examples": { + "application/json": { + "errors": [ + "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" + ], + "message": "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "409": { + "description": "Request failed. The workflow is not shared with the user.", + "examples": { + "application/json": { + "errors": [ + "The workflow is not shared with the user." + ], + "message": "The workflow is not shared with the user." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "500": { + "description": "Request failed. Internal controller error.", + "examples": { + "application/json": { + "errors": [ + "Internal controller error." + ], + "message": "Internal controller error." + } + }, + "schema": { + "properties": { + "errors": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "type": "string" + } + }, + "type": "object" + } + } + }, + "summary": "Unshare a workflow with other users." + } + }, "/api/workflows/{workflow_id_or_name}/workspace": { "get": { "description": "This resource retrieves the file list of a workspace, given its workflow UUID.", From 637081531da4ba7993c402362b006f15688287e5 Mon Sep 17 00:00:00 2001 From: Daan Rosendal Date: Tue, 14 Nov 2023 22:44:07 +0100 Subject: [PATCH 3/6] feat(openapi): add endpoint to fetch workflow share status (#429) Adds `reana-server` and `reana-workflow-controller` OpenAPI specifications for retrieving whom a workflow is shared with. Closes reanahub/reana-client#686 --- .../openapi_specifications/reana_server.json | 133 ++++++++++++++++++ .../reana_workflow_controller.json | 133 ++++++++++++++++++ 2 files changed, 266 insertions(+) diff --git a/reana_commons/openapi_specifications/reana_server.json b/reana_commons/openapi_specifications/reana_server.json index 4a32e68f..af777d45 100644 --- a/reana_commons/openapi_specifications/reana_server.json +++ b/reana_commons/openapi_specifications/reana_server.json @@ -3163,6 +3163,139 @@ "summary": "Share a workflow with another user." } }, + "/api/workflows/{workflow_id_or_name}/share-status": { + "get": { + "description": "This resource returns the share status of a given workflow.", + "operationId": "get_workflow_share_status", + "parameters": [ + { + "description": "The API access_token of workflow owner.", + "in": "query", + "name": "access_token", + "required": false, + "type": "string" + }, + { + "description": "Required. Workflow UUID or name.", + "in": "path", + "name": "workflow_id_or_name", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Request succeeded. The response contains the share status of the workflow.", + "examples": { + "application/json": { + "shared_with": [ + { + "user_email": "bob@example.org", + "valid_until": "2022-11-24T23:59:59" + } + ], + "workflow_id": "256b25f4-4cfb-4684-b7a8-73872ef455a1", + "workflow_name": "mytest.1" + } + }, + "schema": { + "properties": { + "shared_with": { + "items": { + "properties": { + "user_email": { + "type": "string" + }, + "valid_until": { + "type": "string", + "x-nullable": true + } + }, + "type": "object" + }, + "type": "array" + }, + "workflow_id": { + "type": "string" + }, + "workflow_name": { + "type": "string" + } + }, + "type": "object" + } + }, + "401": { + "description": "Request failed. User not signed in.", + "examples": { + "application/json": { + "message": "User not signed in." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "403": { + "description": "Request failed. Credentials are invalid or revoked.", + "examples": { + "application/json": { + "message": "Token not valid." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "404": { + "description": "Request failed. Workflow does not exist.", + "examples": { + "application/json": { + "message": "Workflow mytest.1 does not exist." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "500": { + "description": "Request failed. Internal server error.", + "examples": { + "application/json": { + "message": "Something went wrong." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + } + }, + "summary": "Get the share status of a workflow." + } + }, "/api/workflows/{workflow_id_or_name}/specification": { "get": { "description": "This resource returns the REANA workflow specification used to start the workflow run. Resource is expecting a workflow UUID.", diff --git a/reana_commons/openapi_specifications/reana_workflow_controller.json b/reana_commons/openapi_specifications/reana_workflow_controller.json index f66dce6b..4f205d09 100644 --- a/reana_commons/openapi_specifications/reana_workflow_controller.json +++ b/reana_commons/openapi_specifications/reana_workflow_controller.json @@ -1184,6 +1184,139 @@ "summary": "Share a workflow with other users." } }, + "/api/workflows/{workflow_id_or_name}/share-status": { + "get": { + "description": "This resource returns the share status of a given workflow.", + "operationId": "get_workflow_share_status", + "parameters": [ + { + "description": "Required. UUID of workflow owner.", + "in": "query", + "name": "user_id", + "required": true, + "type": "string" + }, + { + "description": "Required. Workflow UUID or name.", + "in": "path", + "name": "workflow_id_or_name", + "required": true, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Request succeeded. The response contains the share status of the workflow.", + "examples": { + "application/json": { + "shared_with": [ + { + "user_email": "bob@example.org", + "valid_until": "2022-11-24T23:59:59" + } + ], + "workflow_id": "256b25f4-4cfb-4684-b7a8-73872ef455a1", + "workflow_name": "mytest.1" + } + }, + "schema": { + "properties": { + "shared_with": { + "items": { + "properties": { + "user_email": { + "type": "string" + }, + "valid_until": { + "type": "string", + "x-nullable": true + } + }, + "type": "object" + }, + "type": "array" + }, + "workflow_id": { + "type": "string" + }, + "workflow_name": { + "type": "string" + } + }, + "type": "object" + } + }, + "401": { + "description": "Request failed. User not signed in.", + "examples": { + "application/json": { + "message": "User not signed in." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "403": { + "description": "Request failed. Credentials are invalid or revoked.", + "examples": { + "application/json": { + "message": "Token not valid." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "404": { + "description": "Request failed. Workflow does not exist.", + "examples": { + "application/json": { + "message": "Workflow mytest.1 does not exist." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "500": { + "description": "Request failed. Internal server error.", + "examples": { + "application/json": { + "message": "Something went wrong." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + } + }, + "summary": "Get the share status of a workflow." + } + }, "/api/workflows/{workflow_id_or_name}/status": { "get": { "description": "This resource reports the status of workflow.", From d4c03586ce55e4b24b9325fe2b1c353bf3d71684 Mon Sep 17 00:00:00 2001 From: Daan Rosendal Date: Tue, 21 Nov 2023 19:22:20 +0100 Subject: [PATCH 4/6] feat(openapi): add share-related parameters to `get_workflows` (#429) Adds new `shared`, `shared_with` and `shared_by` parameters to the `get_workflows` endpoint to retrieve workflows along with their sharing information. Closes reanahub/reana-client#687 --- .../openapi_specifications/reana_server.json | 27 +++++++++++++++++++ .../reana_workflow_controller.json | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/reana_commons/openapi_specifications/reana_server.json b/reana_commons/openapi_specifications/reana_server.json index af777d45..79658d7c 100644 --- a/reana_commons/openapi_specifications/reana_server.json +++ b/reana_commons/openapi_specifications/reana_server.json @@ -1324,6 +1324,27 @@ "name": "workflow_id_or_name", "required": false, "type": "string" + }, + { + "description": "Optional flag to list all shared (owned and unowned) workflows.", + "in": "query", + "name": "shared", + "required": false, + "type": "boolean" + }, + { + "description": "Optional argument to list workflows shared by the specified user(s).", + "in": "query", + "name": "shared_by", + "required": false, + "type": "string" + }, + { + "description": "Optional argument to list workflows shared with the specified user(s).", + "in": "query", + "name": "shared_with", + "required": false, + "type": "string" } ], "produces": [ @@ -1398,6 +1419,9 @@ "name": { "type": "string" }, + "owner_email": { + "type": "string" + }, "progress": { "properties": { "current_command": { @@ -1488,6 +1512,9 @@ "session_uri": { "type": "string" }, + "shared_with": { + "type": "string" + }, "size": { "properties": { "human_readable": { diff --git a/reana_commons/openapi_specifications/reana_workflow_controller.json b/reana_commons/openapi_specifications/reana_workflow_controller.json index 4f205d09..db22f201 100644 --- a/reana_commons/openapi_specifications/reana_workflow_controller.json +++ b/reana_commons/openapi_specifications/reana_workflow_controller.json @@ -89,6 +89,27 @@ "name": "workflow_id_or_name", "required": false, "type": "string" + }, + { + "description": "Optional flag to list all shared (owned and unowned) workflows.", + "in": "query", + "name": "shared", + "required": false, + "type": "boolean" + }, + { + "description": "Optional argument to list workflows shared by the specified user(s).", + "in": "query", + "name": "shared_by", + "required": false, + "type": "string" + }, + { + "description": "Optional argument to list workflows shared with the specified user(s).", + "in": "query", + "name": "shared_with", + "required": false, + "type": "string" } ], "produces": [ @@ -167,9 +188,15 @@ "name": { "type": "string" }, + "owner_email": { + "type": "string" + }, "progress": { "type": "object" }, + "shared_with": { + "type": "string" + }, "size": { "properties": { "human_readable": { From 761a8982e21b9836a726f76cca55dd98f881de27 Mon Sep 17 00:00:00 2001 From: Daan Rosendal Date: Fri, 1 Dec 2023 16:12:03 +0100 Subject: [PATCH 5/6] feat(openapi): add endpoints to fetch sharing users (#429) Adds two endpoints: - fetch who shared workflows with the user - fetch who the user shared workflows with Closes reanahub/reana-server#648 and reanahub/reana-server#649 --- .../openapi_specifications/reana_server.json | 210 ++++++++++++++++++ 1 file changed, 210 insertions(+) diff --git a/reana_commons/openapi_specifications/reana_server.json b/reana_commons/openapi_specifications/reana_server.json index 79658d7c..cbd02a41 100644 --- a/reana_commons/openapi_specifications/reana_server.json +++ b/reana_commons/openapi_specifications/reana_server.json @@ -1242,6 +1242,216 @@ "summary": "Requests a new access token for the authenticated user." } }, + "/api/users/shared-with-you": { + "get": { + "description": "This resource provides information about users that shared workflow(s) with the authenticated user.", + "operationId": "get_users_shared_with_you", + "parameters": [ + { + "description": "API access_token of user.", + "in": "query", + "name": "access_token", + "required": false, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Users that shared workflow(s) with the authenticated user.", + "examples": { + "application/json": { + "users_shared_with_you": [ + { + "email": "john.doe@example.org", + "full_name": "John Doe", + "username": "jdoe" + } + ] + } + }, + "schema": { + "properties": { + "users": { + "items": { + "properties": { + "email": { + "type": "string" + }, + "full_name": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + } + }, + "401": { + "description": "Error message indicating that the uses is not authenticated.", + "examples": { + "application/json": { + "message": "User not logged in" + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "403": { + "description": "Request failed. User token not valid.", + "examples": { + "application/json": { + "message": "Token is not valid." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "500": { + "description": "Request failed. Internal server error.", + "examples": { + "application/json": { + "message": "Internal server error." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + } + }, + "summary": "Gets users that shared workflow(s) with the authenticated user." + } + }, + "/api/users/you-shared-with": { + "get": { + "description": "This resource provides information about users that the authenticated user shared workflow(s) with.", + "operationId": "get_users_you_shared_with", + "parameters": [ + { + "description": "API access_token of user.", + "in": "query", + "name": "access_token", + "required": false, + "type": "string" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Users that the authenticated user shared workflow(s) with.", + "examples": { + "application/json": { + "users_you_shared_with": [ + { + "email": "john.doe@example.org", + "full_name": "John Doe", + "username": "jdoe" + } + ] + } + }, + "schema": { + "properties": { + "users": { + "items": { + "properties": { + "email": { + "type": "string" + }, + "full_name": { + "type": "string" + }, + "username": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + } + }, + "type": "object" + } + }, + "401": { + "description": "Error message indicating that the uses is not authenticated.", + "examples": { + "application/json": { + "message": "User not logged in" + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "403": { + "description": "Request failed. User token not valid.", + "examples": { + "application/json": { + "message": "Token is not valid." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "500": { + "description": "Request failed. Internal server error.", + "examples": { + "application/json": { + "message": "Internal server error." + } + }, + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + } + }, + "summary": "Gets users that the authenticated user shared workflow(s) with." + } + }, "/api/workflows": { "get": { "description": "This resource return all current workflows in JSON format.", From 3f08c0ad4b403d51264f3973285c03209d04ea33 Mon Sep 17 00:00:00 2001 From: Marco Donadoni Date: Tue, 20 Aug 2024 16:21:13 +0200 Subject: [PATCH 6/6] feat(openapi): update workflow sharing specs after changes (#429) --- .../openapi_specifications/reana_server.json | 261 +++++++++--------- .../reana_workflow_controller.json | 225 +++------------ 2 files changed, 161 insertions(+), 325 deletions(-) diff --git a/reana_commons/openapi_specifications/reana_server.json b/reana_commons/openapi_specifications/reana_server.json index cbd02a41..d7444d3a 100644 --- a/reana_commons/openapi_specifications/reana_server.json +++ b/reana_commons/openapi_specifications/reana_server.json @@ -2,15 +2,11 @@ "info": { "description": "Submit workflows to be run on REANA Cloud", "title": "REANA Server", - "version": "0.9.1" + "version": "0.95.0a1" }, "paths": { "/account/settings/linkedaccounts/": {}, "/account/settings/linkedaccounts/static/{filename}": {}, - "/account/settings/login": {}, - "/account/settings/security/": {}, - "/account/settings/sessions/revoke/": {}, - "/account/settings/static/{filename}": {}, "/api/config": { "get": { "description": "This resource provides configuration needed by Reana-UI.", @@ -148,12 +144,87 @@ "get": { "description": "Retrieve projects from GitLab.", "operationId": "gitlab_projects", + "parameters": [ + { + "description": "The API access_token of the current user.", + "in": "query", + "name": "access_token", + "required": false, + "type": "string" + }, + { + "description": "The search string to filter the project list.", + "in": "query", + "name": "search", + "required": false, + "type": "string" + }, + { + "description": "Results page number (pagination).", + "in": "query", + "name": "page", + "required": false, + "type": "integer" + }, + { + "description": "Number of results per page (pagination).", + "in": "query", + "name": "size", + "required": false, + "type": "integer" + } + ], "produces": [ "application/json" ], "responses": { "200": { - "description": "This resource return all projects owned by the user on GitLab in JSON format." + "description": "This resource return all projects owned by the user on GitLab in JSON format.", + "schema": { + "properties": { + "has_next": { + "type": "boolean" + }, + "has_prev": { + "type": "boolean" + }, + "items": { + "items": { + "properties": { + "hook_id": { + "type": "integer", + "x-nullable": true + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "path": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "type": "object" + }, + "type": "array" + }, + "page": { + "type": "integer" + }, + "size": { + "type": "integer" + }, + "total": { + "type": "integer", + "x-nullable": true + } + }, + "type": "object" + } }, "403": { "description": "Request failed. User token not valid.", @@ -891,10 +962,6 @@ "additionalProperties": { "description": "Secret definition.", "properties": { - "name": { - "description": "Secret name", - "type": "string" - }, "type": { "description": "How will be the secret assigned to the jobs, either exported as an environment variable or mounted as a file.", "enum": [ @@ -1265,9 +1332,7 @@ "application/json": { "users_shared_with_you": [ { - "email": "john.doe@example.org", - "full_name": "John Doe", - "username": "jdoe" + "email": "john.doe@example.org" } ] } @@ -1279,12 +1344,6 @@ "properties": { "email": { "type": "string" - }, - "full_name": { - "type": "string" - }, - "username": { - "type": "string" } }, "type": "object" @@ -1370,9 +1429,7 @@ "application/json": { "users_you_shared_with": [ { - "email": "john.doe@example.org", - "full_name": "John Doe", - "username": "jdoe" + "email": "john.doe@example.org" } ] } @@ -1384,12 +1441,6 @@ "properties": { "email": { "type": "string" - }, - "full_name": { - "type": "string" - }, - "username": { - "type": "string" } }, "type": "object" @@ -1543,14 +1594,14 @@ "type": "boolean" }, { - "description": "Optional argument to list workflows shared by the specified user(s).", + "description": "Optional argument to list workflows shared by the specified user.", "in": "query", "name": "shared_by", "required": false, "type": "string" }, { - "description": "Optional argument to list workflows shared with the specified user(s).", + "description": "Optional argument to list workflows shared with the specified user.", "in": "query", "name": "shared_with", "required": false, @@ -1723,7 +1774,10 @@ "type": "string" }, "shared_with": { - "type": "string" + "items": { + "type": "string" + }, + "type": "array" }, "size": { "properties": { @@ -3229,25 +3283,30 @@ "type": "string" }, { - "description": "Required. User to share the workflow with.", - "in": "query", - "name": "user_email_to_share_with", + "description": "JSON object with details of the share.", + "in": "body", + "name": "share_details", "required": true, - "type": "string" - }, - { - "description": "Optional. Message to include when sharing the workflow.", - "in": "query", - "name": "message", - "required": false, - "type": "string" - }, - { - "description": "Optional. Date when access to the workflow will expire (format YYYY-MM-DD).", - "in": "query", - "name": "valid_until", - "required": false, - "type": "string" + "schema": { + "properties": { + "message": { + "description": "Optional. Message to include when sharing the workflow.", + "type": "string" + }, + "user_email_to_share_with": { + "description": "User to share the workflow with.", + "type": "string" + }, + "valid_until": { + "description": "Optional. Date when access to the workflow will expire (format YYYY-MM-DD).", + "type": "string" + } + }, + "required": [ + "user_email_to_share_with" + ], + "type": "object" + } } ], "produces": [ @@ -3279,23 +3338,25 @@ } }, "400": { - "description": "Request failed. The incoming data specification seems malformed.", + "description": "Request failed. The incoming data seems malformed.", + "schema": { + "properties": { + "message": { + "type": "string" + } + }, + "type": "object" + } + }, + "401": { + "description": "Request failed. User not signed in.", "examples": { "application/json": { - "errors": [ - "Missing data for required field." - ], - "message": "Malformed request." + "message": "User not signed in." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -3304,12 +3365,10 @@ } }, "403": { - "description": "Request failed. User is not allowed to share the workflow.", + "description": "Request failed. Credentials are invalid or revoked.", "examples": { "application/json": { - "errors": [ - "User is not allowed to share the workflow." - ] + "message": "Token not valid." } }, "schema": { @@ -3325,20 +3384,11 @@ "description": "Request failed. Workflow does not exist or user does not exist.", "examples": { "application/json": { - "errors": [ - "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" - ], "message": "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -3350,20 +3400,11 @@ "description": "Request failed. The workflow is already shared with the user.", "examples": { "application/json": { - "errors": [ - "The workflow is already shared with the user." - ], "message": "The workflow is already shared with the user." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -3375,20 +3416,11 @@ "description": "Request failed. Internal controller error.", "examples": { "application/json": { - "errors": [ - "Internal controller error." - ], "message": "Internal controller error." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -4384,20 +4416,11 @@ "description": "Request failed. The incoming data specification seems malformed.", "examples": { "application/json": { - "errors": [ - "Missing data for required field." - ], "message": "Malformed request." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -4409,19 +4432,11 @@ "description": "Request failed. User is not allowed to unshare the workflow.", "examples": { "application/json": { - "errors": [ - "User is not allowed to unshare the workflow." - ] + "message": "User is not allowed to unshare the workflow." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -4433,20 +4448,11 @@ "description": "Request failed. Workflow does not exist or user does not exist.", "examples": { "application/json": { - "errors": [ - "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" - ], "message": "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -4458,20 +4464,11 @@ "description": "Request failed. The workflow is not shared with the user.", "examples": { "application/json": { - "errors": [ - "The workflow is not shared with the user." - ], "message": "The workflow is not shared with the user." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -4483,20 +4480,11 @@ "description": "Request failed. Internal controller error.", "examples": { "application/json": { - "errors": [ - "Internal controller error." - ], "message": "Internal controller error." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -5212,6 +5200,7 @@ "/oauth/disconnect/{remote_app}/": {}, "/oauth/login": {}, "/oauth/login/{remote_app}/": {}, + "/oauth/logout": {}, "/oauth/signup/{remote_app}/": {}, "/oauth/static/{filename}": {}, "/signin": {}, diff --git a/reana_commons/openapi_specifications/reana_workflow_controller.json b/reana_commons/openapi_specifications/reana_workflow_controller.json index db22f201..200aac6f 100644 --- a/reana_commons/openapi_specifications/reana_workflow_controller.json +++ b/reana_commons/openapi_specifications/reana_workflow_controller.json @@ -2,7 +2,7 @@ "info": { "description": "Submit and manage workflows", "title": "REANA Workflow Controller", - "version": "0.9.1" + "version": "0.95.0a1" }, "paths": { "/api/workflows": { @@ -98,14 +98,14 @@ "type": "boolean" }, { - "description": "Optional argument to list workflows shared by the specified user(s).", + "description": "Optional argument to list workflows shared by the specified user.", "in": "query", "name": "shared_by", "required": false, "type": "string" }, { - "description": "Optional argument to list workflows shared with the specified user(s).", + "description": "Optional argument to list workflows shared with the specified user.", "in": "query", "name": "shared_with", "required": false, @@ -195,7 +195,10 @@ "type": "object" }, "shared_with": { - "type": "string" + "items": { + "type": "string" + }, + "type": "array" }, "size": { "properties": { @@ -1028,7 +1031,7 @@ { "description": "Required. UUID of workflow owner.", "in": "query", - "name": "user_id", + "name": "user", "required": true, "type": "string" }, @@ -1040,25 +1043,30 @@ "type": "string" }, { - "description": "Required. User to share the workflow with.", - "in": "query", - "name": "user_email_to_share_with", + "description": "JSON object with details of the share.", + "in": "body", + "name": "share_details", "required": true, - "type": "string" - }, - { - "description": "Optional. Message to include when sharing the workflow.", - "in": "query", - "name": "message", - "required": false, - "type": "string" - }, - { - "description": "Optional. Date when access to the workflow will expire (format YYYY-MM-DD).", - "in": "query", - "name": "valid_until", - "required": false, - "type": "string" + "schema": { + "properties": { + "message": { + "description": "Optional. Message to include when sharing the workflow.", + "type": "string" + }, + "user_email_to_share_with": { + "description": "User to share the workflow with.", + "type": "string" + }, + "valid_until": { + "description": "Optional. Date when access to the workflow will expire (format YYYY-MM-DD).", + "type": "string" + } + }, + "required": [ + "user_email_to_share_with" + ], + "type": "object" + } } ], "produces": [ @@ -1090,121 +1098,30 @@ } }, "400": { - "description": "Request failed. The incoming data specification seems malformed.", - "examples": { - "application/json": { - "errors": [ - "Missing data for required field." - ], - "message": "Malformed request." - } - }, - "schema": { - "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, - "message": { - "type": "string" - } - }, - "type": "object" - } - }, - "403": { - "description": "Request failed. User is not allowed to share the workflow.", - "examples": { - "application/json": { - "errors": [ - "User is not allowed to share the workflow." - ] - } - }, - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "type": "object" - } + "description": "Request failed. The incoming data seems malformed." }, "404": { "description": "Request failed. Workflow does not exist or user does not exist.", "examples": { "application/json": { - "errors": [ - "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" - ], "message": "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" } - }, - "schema": { - "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, - "message": { - "type": "string" - } - }, - "type": "object" } }, "409": { "description": "Request failed. The workflow is already shared with the user.", "examples": { "application/json": { - "errors": [ - "The workflow is already shared with the user." - ], "message": "The workflow is already shared with the user." } - }, - "schema": { - "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, - "message": { - "type": "string" - } - }, - "type": "object" } }, "500": { "description": "Request failed. Internal controller error.", "examples": { "application/json": { - "errors": [ - "Internal controller error." - ], "message": "Internal controller error." } - }, - "schema": { - "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, - "message": { - "type": "string" - } - }, - "type": "object" } } }, @@ -1219,7 +1136,7 @@ { "description": "Required. UUID of workflow owner.", "in": "query", - "name": "user_id", + "name": "user", "required": true, "type": "string" }, @@ -1276,38 +1193,6 @@ "type": "object" } }, - "401": { - "description": "Request failed. User not signed in.", - "examples": { - "application/json": { - "message": "User not signed in." - } - }, - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "type": "object" - } - }, - "403": { - "description": "Request failed. Credentials are invalid or revoked.", - "examples": { - "application/json": { - "message": "Token not valid." - } - }, - "schema": { - "properties": { - "message": { - "type": "string" - } - }, - "type": "object" - } - }, "404": { "description": "Request failed. Workflow does not exist.", "examples": { @@ -1586,7 +1471,7 @@ { "description": "Required. UUID of workflow owner.", "in": "query", - "name": "user_id", + "name": "user", "required": true, "type": "string" }, @@ -1637,20 +1522,11 @@ "description": "Request failed. The incoming data specification seems malformed.", "examples": { "application/json": { - "errors": [ - "Missing data for required field." - ], "message": "Malformed request." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -1662,9 +1538,7 @@ "description": "Request failed. User is not allowed to unshare the workflow.", "examples": { "application/json": { - "errors": [ - "User is not allowed to unshare the workflow." - ] + "message": "User is not allowed to unshare the workflow." } }, "schema": { @@ -1680,20 +1554,11 @@ "description": "Request failed. Workflow does not exist or user does not exist.", "examples": { "application/json": { - "errors": [ - "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" - ], "message": "Workflow cdcf48b1-c2f3-4693-8230-b066e088c6ac does not exist" } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -1705,20 +1570,11 @@ "description": "Request failed. The workflow is not shared with the user.", "examples": { "application/json": { - "errors": [ - "The workflow is not shared with the user." - ], "message": "The workflow is not shared with the user." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -1730,20 +1586,11 @@ "description": "Request failed. Internal controller error.", "examples": { "application/json": { - "errors": [ - "Internal controller error." - ], "message": "Internal controller error." } }, "schema": { "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, "message": { "type": "string" } @@ -1981,7 +1828,7 @@ ], "responses": { "200": { - "description": "Requests succeeded. The file has been downloaded.", + "description": "Request succeeded. Details about deleted files and failed deletions are returned.", "schema": { "type": "file" }