Skip to content

Commit

Permalink
Merge pull request #15655 from opf/code-maintenance/55158-extend-stor…
Browse files Browse the repository at this point in the history
…age-api-to-include-completeness

[#55158] Add complete attribute to storage representer
  • Loading branch information
Kharonus authored May 24, 2024
2 parents 5af1496 + f01cf46 commit 50d5877
Show file tree
Hide file tree
Showing 15 changed files with 659 additions and 160 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Example: Nextcloud storage on creation (includes client secret)
---
value:
_type: Storage
id: 1337
name: My New DeathStar
hasApplicationPassword: false
createdAt: '2024-05-21T09:11:53.880Z'
updatedAt: '2024-05-21T09:11:53.880Z'
complete: false
_embedded:
oauthApplication:
id: 42
_type: OAuthApplication
name: My New DeathStar (Nextcloud)
clientId: gNQ-gi3VX59ruoft5B9aRmukEYbZOhKIsxXE9iT1tcQ
confidential: true
clientSecret: 79hIlb1Ezj5kPx8LgE6LI9L1-mb8g7jX1-u_a08RJlI
createdAt: '2024-05-21T09:11:53.908Z'
updatedAt: '2024-05-21T09:11:53.908Z'
scopes:
- api_v3
_links:
self:
href: '/api/v3/oauth_applications/42'
owner:
href: '/api/v3/users/13'
title: Darth Vader
integration:
href: '/api/v3/storages/1337'
title: My New DeathStar
redirectUri:
- href: 'https://nextcloud.deathstar.rocks/index.php/apps/integration_openproject/oauth-redirect'
_links:
self:
href: /api/v3/storages/1337
title: My New DeathStar
type:
href: urn:openproject-org:api:v3:storages:Nextcloud
title: Nextcloud
origin:
href: https://nextcloud.deathstar.rocks/
open:
href: /api/v3/storages/1337/open
prepareUpload: []
authorizationState:
href: urn:openproject-org:api:v3:storages:authorization:FailedAuthorization
title: Authorization failed
projectStrages:
href: /api/v3/project_storages?filters=[{"storageId":{"operator":"=","values":["1337"]}}]
oauthApplication:
href: /api/v3/oauth_application/42
title: My New DeathStar (Nextcloud)
oauthClientCredentials:
href: null
86 changes: 86 additions & 0 deletions docs/api/apiv3/components/examples/storage-nextcloud-response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Example: Nextcloud storage
---
value:
_type: Storage
id: 1337
name: It's no moon
hasApplicationPassword: true
createdAt: '2021-12-20T13:37:00.211Z'
updatedAt: '2021-12-20T13:37:00.211Z'
complete: true
_embedded:
oauthApplication:
id: 42
_type: OAuthApplication
name: It's no moon (Nextcloud)
clientId: O5h6WObhMg1Z8IcLHRE3_LMh4jJYmmca2V6OTFSv8DA
confidential: true
createdAt: '2022-12-07T12:56:42.626Z'
updatedAt: '2022-12-07T12:56:42.626Z'
scopes:
- api_v3
_links:
self:
href: '/api/v3/oauth_applications/42'
owner:
href: '/api/v3/users/13'
title: Darth Vader
integration:
href: '/api/v3/storages/1337'
title: It's no moon
redirectUri:
- href: 'https://nextcloud.deathstar.rocks/index.php/apps/integration_openproject/oauth-redirect'
oauthClientCredentials:
_type: OAuthClientCredentials
id: 42
clientId: fGEFWxIpROrpci25TW6qWCZozDFEAKSkonMBkrf3LYvBXRljBbLajBf2vD2fjePm
confidential: true
createdAt: '2023-12-08T09:49:24.397Z'
updatedAt: '2023-12-08T09:49:24.397Z'
_links:
self:
href: /api/v3/oauth_client_credentials/42
integration:
href: /api/v3/storages/1337
title: It's no moon
_links:
self:
href: /api/v3/storages/1337
title: It's no moon
type:
href: urn:openproject-org:api:v3:storages:Nextcloud
title: Nextcloud
origin:
href: https://nextcloud.deathstar.rocks/
prepareUpload:
- href: /api/v3/storages/1337/files/prepare_upload
method: post
title: Upload file
payload:
projectId: 21
fileName: '{fileName}'
parent: '{parent}'
templated: true
- href: /api/v3/storages/95/files/prepare_upload
method: post
title: Upload file
payload:
projectId: 11
fileName: '{fileName}'
parent: '{parent}'
templated: true
open:
href: /api/v3/storages/1337/open
authorizationState:
href: urn:openproject-org:api:v3:storages:authorization:Connected
title: Connected
# authorize:
# href: https://nextcloud.deathstar.rocks/authorize/
# title: Authorize
projectStrages:
href: /api/v3/project_storages?filters=[{"storageId":{"operator":"=","values":["1337"]}}]
oauthApplication:
href: /api/v3/oauth_application/42
title: It's no moon (Nextcloud)
oauthClientCredentials:
href: /api/v3/oauth_client_credentials/42
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Example: Nextcloud storage
---
value:
_type: Storage
id: 1337
name: It's no moon
hasApplicationPassword: false
createdAt: '2021-12-20T13:37:00.211Z'
updatedAt: '2021-12-20T13:37:00.211Z'
complete: true
_embedded:
oauthApplication:
id: 42
_type: OAuthApplication
name: It's no moon (Nextcloud)
clientId: O5h6WObhMg1Z8IcLHRE3_LMh4jJYmmca2V6OTFSv8DA
confidential: true
createdAt: '2022-12-07T12:56:42.626Z'
updatedAt: '2022-12-07T12:56:42.626Z'
scopes:
- api_v3
_links:
self:
href: '/api/v3/oauth_applications/42'
owner:
href: '/api/v3/users/13'
title: Darth Vader
integration:
href: '/api/v3/storages/1337'
title: It's no moon
redirectUri:
- href: 'https://nextcloud.deathstar.rocks/index.php/apps/integration_openproject/oauth-redirect'
oauthClientCredentials:
_type: OAuthClientCredentials
id: 42
clientId: fGEFWxIpROrpci25TW6qWCZozDFEAKSkonMBkrf3LYvBXRljBbLajBf2vD2fjePm
confidential: true
createdAt: '2023-12-08T09:49:24.397Z'
updatedAt: '2023-12-08T09:49:24.397Z'
_links:
self:
href: /api/v3/oauth_client_credentials/42
integration:
href: /api/v3/storages/1337
title: It's no moon
_links:
self:
href: /api/v3/storages/1337
title: It's no moon
type:
href: urn:openproject-org:api:v3:storages:Nextcloud
title: Nextcloud
origin:
href: https://nextcloud.deathstar.rocks/
prepareUpload: []
open:
href: /api/v3/storages/1337/open
authorizationState:
href: urn:openproject-org:api:v3:storages:authorization:FailedAuthorization
title: Authorization failed
authorize:
href: https://nextcloud25.local/index.php/apps/oauth2/authorize?client_id=fnrIeJZqqAKGQlejuDaGhSQfCAVtoayHLACWCYcPJ0w17Pp6daPPUktkM9QaGxca&redirect_uri=https://openproject.local/oauth_clients/fnrIeJZqqAKGQlejuDaGhSQfCAVtoayHLACWCYcPJ0w17Pp6daPPUktkM9QaGxca/callback&response_type=code
title: Authorize
projectStrages:
href: /api/v3/project_storages?filters=[{"storageId":{"operator":"=","values":["1337"]}}]
oauthApplication:
href: /api/v3/oauth_application/42
title: It's no moon (Nextcloud)
oauthClientCredentials:
href: /api/v3/oauth_client_credentials/42
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Example: OneDrive storage
---
value:
_type: Storage
id: 1337
name: It's no moon
tenantId: e36f1dbc-fdae-427e-b61b-0d96ddfb81a4
driveId: null
createdAt: '2021-12-20T13:37:00.211Z'
updatedAt: '2021-12-20T13:37:00.211Z'
complete: false
_links:
self:
href: /api/v3/storages/1337
title: It's no moon
type:
href: urn:openproject-org:api:v3:storages:OneDrive
title: OneDrive/SharePoint
prepareUpload: []
open:
href: /api/v3/storages/1337/open
authorizationState:
href: urn:openproject-org:api:v3:storages:authorization:FailedAuthorization
title: Authorization failed
projectStrages:
href: /api/v3/project_storages?filters=[{"storageId":{"operator":"=","values":["1337"]}}]
oauthClientCredentials:
href: /api/v3/oauth_client_credentials/42
50 changes: 50 additions & 0 deletions docs/api/apiv3/components/examples/storage-one-drive-response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Example: OneDrive storage
---
value:
_type: Storage
id: 1337
name: It's no moon
tenantId: e36f1dbc-fdae-427e-b61b-0d96ddfb81a4
driveId: b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY8Qconfm2i6SKEoCmuGYqQK
createdAt: '2021-12-20T13:37:00.211Z'
updatedAt: '2021-12-20T13:37:00.211Z'
complete: true
_embedded:
oauthClientCredentials:
_type: OAuthClientCredentials
id: 42
clientId: b8a5bb54-5fb2-4e0e-9427-9d24dbac32ff
confidential: true
createdAt: '2023-12-08T09:49:24.397Z'
updatedAt: '2023-12-08T09:49:24.397Z'
_links:
self:
href: /api/v3/oauth_client_credentials/42
integration:
href: /api/v3/storages/1337
title: It's no moon
_links:
self:
href: /api/v3/storages/1337
title: It's no moon
type:
href: urn:openproject-org:api:v3:storages:OneDrive
title: OneDrive/SharePoint
prepareUpload:
- href: /api/v3/storages/1337/files/prepare_upload
method: post
title: Upload file
payload:
projectId: 33
fileName: '{fileName}'
parent: '{parent}'
templated: true
open:
href: /api/v3/storages/1337/open
authorizationState:
href: urn:openproject-org:api:v3:storages:authorization:Connected
title: Connected
projectStrages:
href: /api/v3/project_storages?filters=[{"storageId":{"operator":"=","values":["1337"]}}]
oauthClientCredentials:
href: /api/v3/oauth_client_credentials/42
18 changes: 10 additions & 8 deletions docs/api/apiv3/components/schemas/oauth_application_read_model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,18 @@ properties:
**Resource**: Storage
redirectUri:
allOf:
- $ref: './link.yml'
- description: |-
The redirect URI of the OAuth application
**Resource**: N/A
type: array
items:
allOf:
- $ref: './link.yml'
- description: |-
A redirect URI of the OAuth application
**Resource**: N/A

example:
id: 1337
_type: OauthClientCredentials
_type: OAuthApplication
name: Vader's secure OAuth app
clientId: O5h6WObhMg1Z8IcLHRE3_LMh4jJYmmca2V6OTFSv8DA
confidential: true
Expand All @@ -98,4 +100,4 @@ example:
href: '/api/v3/storages/42'
title: Death Star Cloud
redirectUri:
href: 'https://death-star.cloud.tools/index.php/apps/integration_openproject/oauth-redirect'
- href: 'https://death-star.cloud.tools/index.php/apps/integration_openproject/oauth-redirect'
Loading

0 comments on commit 50d5877

Please sign in to comment.