-
Notifications
You must be signed in to change notification settings - Fork 6
/
permission.clj
287 lines (232 loc) · 14.9 KB
/
permission.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
(ns common-swagger-api.schema.apps.permission
(:use [common-swagger-api.schema
:only [CommonResponses
describe
ErrorResponse
ErrorResponseForbidden
ErrorResponseNotFound
NonBlankString]]
[common-swagger-api.schema.apps :only [QualifiedAppId]]
[schema.core :only [defschema enum optional-key]])
(:import (java.util UUID)))
(def AnalysisPermissionListingSummary "List Analysis Permissions")
(def AnalysisPermissionListingDocs
"This endpoint allows the caller to list the permissions for one or more analyses.
The authenticated user must have read permission on every analysis in the request body for this endpoint to succeed.")
(def AnalysisSharingSummary "Add Analysis Permissions")
(def AnalysisSharingDocs
"This endpoint allows the caller to share multiple analyses with multiple users.
The authenticated user must have ownership permission to every analysis in the request body for this endpoint to fully succeed.
Note: this is a potentially slow operation and the response is returned synchronously.
The DE UI handles this by allowing the user to continue working while the request is being processed.
When calling this endpoint, please be sure that the response timeout is long enough.
Using a response timeout that is too short will result in an exception on the client side.
On the server side, the result of the sharing operation when a connection is lost is undefined.
It may be worthwhile to repeat failed or timed out calls to this endpoint.")
(def AnalysisUnsharingSummary "Revoke Analysis Permissions")
(def AnalysisUnsharingDocs
"This endpoint allows the caller to revoke permission to access one or more analyses from one or more users.
The authenticate user must have ownership permission to every analysis in the request body for this endoint to fully succeed.
Note: like analysis sharing, this is a potentially slow operation.")
(def AppPermissionListingSummary "List App Permissions")
(def AppPermissionListingDocs
"This endpoint allows the caller to list the permissions for one or more apps.
The authenticated user must have read permission on every app in the request body for this endpoint to succeed.")
(def AppSharingSummary "Add App Permissions")
(def AppSharingDocs
"This endpoint allows the caller to share multiple apps with multiple users.
The authenticated user must have ownership permission to every app in the request body for this endpoint to fully succeed.
Note: this is a potentially slow operation and the response is returned synchronously.
The DE UI handles this by allowing the user to continue working while the request is being processed.
When calling this endpoint, please be sure that the response timeout is long enough.
Using a response timeout that is too short will result in an exception on the client side.
On the server side, the result of the sharing operation when a connection is lost is undefined.
It may be worthwhile to repeat failed or timed out calls to this endpoint.")
(def AppUnsharingSummary "Revoke App Permissions")
(def AppUnsharingDocs
"This endpoint allows the caller to revoke permission to access one or more apps from one or more users.
The authenticate user must have ownership permission to every app in the request body for this endoint to fully succeed.
Note: like app sharing, this is a potentially slow operation.")
(def ToolSharingSummary "Add Tool Permissions")
(def ToolSharingDocs
"This endpoint allows the caller to share multiple Tools with multiple users.
The authenticated user must have ownership permission to every Tool in the request body for this endpoint to fully succeed.
Note: this is a potentially slow operation and the response is returned synchronously.
The DE UI handles this by allowing the user to continue working while the request is being processed.
When calling this endpoint, please be sure that the response timeout is long enough.
Using a response timeout that is too short will result in an exception on the client side.
On the server side, the result of the sharing operation when a connection is lost is undefined.
It may be worthwhile to repeat failed or timed out calls to this endpoint.")
(def ToolUnsharingSummary "Revoke Tool Permissions")
(def ToolUnsharingDocs
"This endpoint allows the caller to revoke permission to access one or more Tools from one or more users.
The authenticated user must have ownership permission to every Tool in the request body for this endoint to fully succeed.
Note: like Tool sharing, this is a potentially slow operation.")
(def AppPermissionEnum (enum "read" "write" "own" ""))
(def AnalysisPermissionEnum (enum "read" "own" ""))
(def ToolPermissionEnum AppPermissionEnum)
(defschema PermissionListerQueryParams
{(optional-key :full-listing)
(describe Boolean "If true, include permissions for the authenticated user as well")})
(defschema Subject
{:source_id (describe NonBlankString "The identifier of the subject source (for exmaple, 'ldap')")
:id (describe NonBlankString "The subject identifier")})
(defschema AppPermissionListingRequest
(describe
{:apps (describe [QualifiedAppId] "A List of qualified app identifiers")}
"The app permission listing request."))
(defschema SubjectPermissionListElement
{:subject (describe Subject "The user or group identification")
:permission (describe AppPermissionEnum "The permission level assigned to the subject")})
(defschema AppPermissionListElement
(assoc QualifiedAppId
(optional-key :name) (describe NonBlankString "The app name")
:permissions (describe [SubjectPermissionListElement] "The list of subject permissions for the app")))
(defschema AppPermissionListing
{:apps (describe [AppPermissionListElement] "The list of app permissions")})
(defschema AppSharingRequestElement
(assoc QualifiedAppId
:permission (describe AppPermissionEnum "The requested permission level")))
(defschema AppSharingResponseElement
(assoc AppSharingRequestElement
:app_name (describe NonBlankString "The app name")
:success (describe Boolean "A Boolean flag indicating whether the sharing request succeeded")
(optional-key :error) (describe ErrorResponse "Information about any error that may have occurred")))
(defschema SubjectAppSharingRequestElement
{:subject (describe Subject "The user or group identification")
:apps (describe [AppSharingRequestElement] "The list of app sharing requests for the subject")})
(defschema SubjectAppSharingResponseElement
(assoc SubjectAppSharingRequestElement
:apps (describe [AppSharingResponseElement] "The list of app sharing responses for the subject")))
(defschema AppSharingRequest
(describe
{:sharing (describe [SubjectAppSharingRequestElement] "The list of app sharing requests")}
"The app sharing request."))
(defschema AppSharingResponse
{:sharing (describe [SubjectAppSharingResponseElement] "The list of app sharing responses")})
(defschema AppUnsharingResponseElement
(assoc QualifiedAppId
:app_name (describe NonBlankString "The app name")
:success (describe Boolean "A Boolean flag indicating whether the unsharing request succeeded")
(optional-key :error) (describe ErrorResponse "Information about any error that may have occurred")))
(defschema SubjectAppUnsharingRequestElement
{:subject (describe Subject "The user or group identification")
:apps (describe [QualifiedAppId] "The list of app unsharing requests for the subject")})
(defschema SubjectAppUnsharingResponseElement
(assoc SubjectAppUnsharingRequestElement
:apps (describe [AppUnsharingResponseElement] "The list of app sharing responses for the subject")))
(defschema AppUnsharingRequest
(describe
{:unsharing (describe [SubjectAppUnsharingRequestElement] "The list of app unsharing requests")}
"The app unsharing request."))
(defschema AppUnsharingResponse
{:unsharing (describe [SubjectAppUnsharingResponseElement] "The list of app unsharing responses")})
(defschema AnalysisIdList
(-> {:analyses (describe [UUID] "A List of analysis IDs")}
(describe "The analysis permission listing request.")))
(defschema AnalysisPermissionListElement
{:id (describe UUID "The analysis ID")
:name (describe NonBlankString "The analysis name")
:permissions (describe [SubjectPermissionListElement] "The list of subject permissions for the analysis")})
(defschema AnalysisPermissionListing
{:analyses (describe [AnalysisPermissionListElement] "The list of analysis permissions")})
(defschema AnalysisSharingRequestElement
{:analysis_id (describe UUID "The analysis ID")
:permission (describe AnalysisPermissionEnum "The requested permission level")})
(defschema AnalysisSharingResponseElement
(assoc AnalysisSharingRequestElement
:analysis_name (describe NonBlankString "The analysis name")
:success (describe Boolean "A Boolean flag indicating whether the sharing request succeeded")
(optional-key :input_errors) (describe [NonBlankString] "A list of any analysis input sharing errors")
(optional-key :outputs_error) (describe NonBlankString "A brief reason for any result folder sharing errors")
(optional-key :app_error) (describe NonBlankString "A brief reason for any app sharing errors")
(optional-key :error) (describe ErrorResponse "Information about any error that may have occurred")))
(defschema SubjectAnalysisSharingRequestElement
{:subject (describe Subject "The user or group identification.")
:analyses (describe [AnalysisSharingRequestElement] "The list of sharing requests for individual analyses")})
(defschema SubjectAnalysisSharingResponseElement
(assoc SubjectAnalysisSharingRequestElement
:analyses (describe [AnalysisSharingResponseElement] "The list of analysis sharing responses for the subject")))
(defschema AnalysisSharingRequest
(-> {:sharing (describe [SubjectAnalysisSharingRequestElement]
"The list of sharing requests for individual subjects")}
(describe "The analysis sharing request.")))
(defschema AnalysisSharingResponse
{:sharing (describe [SubjectAnalysisSharingResponseElement] "The list of sharing responses for individual subjects")})
(defschema AnalysisUnsharingResponseElement
{:analysis_id (describe UUID "The analysis ID")
:analysis_name (describe NonBlankString "The analysis name")
:success (describe Boolean "A Boolean flag indicating whether the unsharing request succeeded")
(optional-key :input_errors) (describe [NonBlankString] "A list of any analysis input unsharing errors")
(optional-key :outputs_error) (describe NonBlankString "A brief reason for the result folder unsharing error")
(optional-key :error) (describe ErrorResponse "Information about any error that may have occurred")})
(defschema SubjectAnalysisUnsharingRequestElement
{:subject (describe Subject "The user or group identification.")
:analyses (describe [UUID] "The identifiers of the analyses to unshare")})
(defschema SubjectAnalysisUnsharingResponseElement
(assoc SubjectAnalysisUnsharingRequestElement
:analyses (describe [AnalysisUnsharingResponseElement] "The list of analysis unsharing responses for the subject")))
(defschema AnalysisUnsharingRequest
(-> {:unsharing (describe [SubjectAnalysisUnsharingRequestElement]
"The list of unsharing requests for individual subjects")}
(describe "The analysis unsharing request.")))
(defschema AnalysisUnsharingResponse
{:unsharing
(describe [SubjectAnalysisUnsharingResponseElement] "The list of unsharing responses for individual subjects")})
(defschema ToolIdList
(describe
{:tools (describe [UUID] "A List of Tool IDs")}
"The Tool permission listing request."))
(defschema ToolPermissionListElement
{:id (describe UUID "The Tool ID")
:name (describe NonBlankString "The Tool name")
:permissions (describe [SubjectPermissionListElement] "The list of subject permissions for the Tool")})
(defschema ToolPermissionListing
{:tools (describe [ToolPermissionListElement] "The list of Tool permissions")})
(defschema ToolSharingRequestElement
{:tool_id (describe UUID "The Tool ID")
:permission (describe ToolPermissionEnum "The requested permission level")})
(defschema ToolSharingResponseElement
(assoc ToolSharingRequestElement
:tool_name (describe NonBlankString "The Tool name")
:success (describe Boolean "A Boolean flag indicating whether the sharing request succeeded")
(optional-key :error) (describe ErrorResponse "Information about any error that may have occurred")))
(defschema SubjectToolSharingRequestElement
{:subject (describe Subject "The user or group identification.")
:tools (describe [ToolSharingRequestElement] "The list of Tool sharing requests for the subject")})
(defschema SubjectToolSharingResponseElement
(assoc SubjectToolSharingRequestElement
:tools (describe [ToolSharingResponseElement] "The list of Tool sharing responses for the subject")))
(defschema ToolSharingRequest
(describe
{:sharing (describe [SubjectToolSharingRequestElement] "The list of Tool sharing requests")}
"The Tool sharing request."))
(defschema ToolSharingResponse
{:sharing (describe [SubjectToolSharingResponseElement] "The list of Tool sharing responses")})
(defschema ToolUnsharingResponseElement
{:tool_id (describe UUID "The Tool ID")
:tool_name (describe NonBlankString "The Tool name")
:success (describe Boolean "A Boolean flag indicating whether the unsharing request succeeded")
(optional-key :error) (describe ErrorResponse "Information about any error that may have occurred")})
(defschema SubjectToolUnsharingRequestElement
{:subject (describe Subject "The user or group identification.")
:tools (describe [UUID] "The identifiers of the Tools to unshare")})
(defschema SubjectToolUnsharingResponseElement
(assoc SubjectToolUnsharingRequestElement
:tools (describe [ToolUnsharingResponseElement] "The list of Tool unsharing responses for the subject")))
(defschema ToolUnsharingRequest
(describe
{:unsharing
(describe [SubjectToolUnsharingRequestElement] "The list of unsharing requests for individual subjects")}
"The Tool unsharing request."))
(defschema ToolUnsharingResponse
{:unsharing
(describe [SubjectToolUnsharingResponseElement] "The list of unsharing responses for individual subjects")})
(def ToolPermissionsListingResponses
(merge CommonResponses
{200 {:schema ToolPermissionListing
:description "The Tool permission listings."}
403 {:schema ErrorResponseForbidden
:description "The requesting user does not have `read` permission for some Tool(s) in the request."}
404 {:schema ErrorResponseNotFound
:description "Some `tool-id`(s) in the request do not exist."}}))