-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathworkspace.ts
More file actions
488 lines (418 loc) · 9.32 KB
/
workspace.ts
File metadata and controls
488 lines (418 loc) · 9.32 KB
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
import { gql } from 'apollo-server-express';
export default gql`
"""
Response of updated workspace mutations
"""
type UpdateWorkspaceResponse {
"""
Id of updated workspace
"""
recordId: ID!
"""
Updated workspace object
"""
record: Workspace!
}
"""
Confirmed member data in workspace
"""
type ConfirmedMember {
"""
Member info id
"""
id: ID! @renameFrom(name: "_id")
"""
If member accepts an invitation, the user id will be stored there
"""
user: User!
"""
True if user has admin permissions
"""
isAdmin: Boolean!
}
"""
Pending member data in workspace
"""
type PendingMember {
"""
Member info id
"""
id: ID! @renameFrom(name: "_id")
"""
Email to which the invitation was sent
"""
email: String! @renameFrom(name: "userEmail")
}
"""
Represents two types of Members in workspace's team
"""
union Member = ConfirmedMember | PendingMember
"""
Represent Workspace info
"""
type Workspace {
"""
Workspace id
"""
id: ID! @renameFrom(name: "_id")
"""
Workspace name
"""
name: String
"""
Workspace description
"""
description: String
"""
Date of creating workspace
"""
creationDate: DateTime!
"""
Workspace logo image
"""
image: String
"""
Workspace team info
"""
team: [Member!]!
"""
Invite hash for joining in workspace via link
"""
inviteHash: String!
"""
Total number of errors since the last charge date
"""
billingPeriodEventsCount: Int
"""
Workspace tariff plan
"""
plan: Plan
"""
Date when workspace was charged last time
"""
lastChargeDate: DateTime
"""
ID of subscription if it subscribed
Returns from CloudPayments
"""
subscriptionId: String
""" True if workspace is used for debugging """
isDebug: Boolean
""" True if workspace is blocked """
isBlocked: Boolean
"""
For prepaid workspaces, date until which the workspace is paid
"""
paidUntil: DateTime
"""
Workspace projects array
"""
projects(
"""
Project(s) id(s)
"""
ids: [ID!] = []
): [Project!]
"""
SSO configuration (admin only, returns null for non-admin users)
"""
sso: WorkspaceSsoConfig @definedOnlyForAdmins
}
"""
SAML attribute mapping configuration
"""
type SamlAttributeMapping {
"""
Attribute name for email in SAML Assertion
Used to map the email attribute from the SAML response to the email attribute in the Hawk database
"""
email: String!
"""
Attribute name for user name in SAML Assertion
Used to map the name attribute from the SAML response to the name attribute in the Hawk database
"""
name: String
}
"""
SAML SSO configuration
"""
type SamlConfig {
"""
IdP Entity ID
Used to ensure that the SAML response is coming from the correct IdP
"""
idpEntityId: String!
"""
SSO URL
Used to redirect user to the correct IdP
"""
ssoUrl: String!
"""
X.509 certificate (masked for security)
Used to verify the signature of the SAML response
"""
x509Cert: String!
"""
NameID format
Used to specify the format of the NameID in the SAML response
"""
nameIdFormat: String
"""
Attribute mapping
Used to map the attributes from the SAML response to the attributes in the Hawk database
"""
attributeMapping: SamlAttributeMapping!
}
"""
SSO configuration (admin only)
"""
type WorkspaceSsoConfig {
"""
Is SSO enabled
Used to enable or disable SSO for the workspace
"""
enabled: Boolean!
"""
Is SSO enforced
Used to enforce SSO login for the workspace. If true, only SSO login is allowed.
"""
enforced: Boolean!
"""
SSO provider type
Used to specify the type of the SSO provider for the workspace
"""
type: String!
"""
SAML-specific configuration
Used to configure the SAML-specific settings for the workspace
"""
saml: SamlConfig!
}
"""
SAML attribute mapping input
"""
input SamlAttributeMappingInput {
"""
Attribute name for email in SAML Assertion
Used to map the email attribute from the SAML response to the email attribute in the Hawk database
"""
email: String!
"""
Attribute name for user name in SAML Assertion
Used to map the name attribute from the SAML response to the name attribute in the Hawk database
"""
name: String
}
"""
SAML SSO configuration input
"""
input SamlConfigInput {
"""
IdP Entity ID
Used to ensure that the SAML response is coming from the correct IdP
"""
idpEntityId: String!
"""
SSO URL for redirecting user to IdP
Used to redirect user to the correct IdP
"""
ssoUrl: String!
"""
X.509 certificate for signature verification (PEM format)
Used to verify the signature of the SAML response
"""
x509Cert: String!
"""
Desired NameID format
Used to specify the format of the NameID in the SAML response
"""
nameIdFormat: String
"""
Attribute mapping configuration
Used to map the attributes from the SAML response to the attributes in the Hawk database
"""
attributeMapping: SamlAttributeMappingInput!
}
"""
SSO configuration input
"""
input WorkspaceSsoConfigInput {
"""
Is SSO enabled
Used to enable or disable SSO for the workspace
"""
enabled: Boolean!
"""
Is SSO enforced (only SSO login allowed)
Used to enforce SSO login for the workspace. If true, only SSO login is allowed.
"""
enforced: Boolean!
"""
SAML-specific configuration
Used to configure the SAML-specific settings for the workspace
"""
saml: SamlConfigInput!
}
"""
Workspace preview with basic public info
Contains only basic fields: id, name, image
Used for public-facing features like SSO login page
"""
type WorkspacePreview {
"""
Workspace ID
"""
id: ID! @renameFrom(name: "_id")
"""
Workspace name
"""
name: String!
"""
Workspace image/logo URL
"""
image: String
}
extend type Query {
"""
Returns workspace(s) info
If ids = [] returns all user's workspaces
"""
workspaces("Workspace(s) id(s)" ids: [ID] = []): [Workspace]
"""
Get workspace public info by ID for SSO login page
Returns only id, name, image if SSO is enabled for the workspace
Available without authentication
"""
ssoWorkspace("Workspace ID" id: ID!): WorkspacePreview @allowAnon
}
extend type Mutation {
"""
Create new workspace
"""
createWorkspace(
"""
New workspace name
"""
name: String! @validate(notEmpty: true)
"""
New workspace description
"""
description: String
"""
New workspace image
"""
image: Upload @uploadImage
): Workspace!
"""
Invite user to workspace
Returns true if operation is successful
"""
inviteToWorkspace(
"""
Email of the user to invite
"""
userEmail: String! @validate(isEmail: true)
"""
id of the workspace to which the user is invited
"""
workspaceId: ID!
): Boolean!
"""
Update workspace settings
"""
updateWorkspace(
"""
What workspace to update
"""
workspaceId: ID!
"""
Workspace name
"""
name: String! @validate(notEmpty: true)
"""
Workspace description
"""
description: String
"""
Workspace image
"""
image: Upload @uploadImage
): Boolean! @requireAdmin
"""
Join to workspace by invite link with hash
"""
joinByInviteLink(
"""
Workspace invite hash from link
"""
inviteHash: String!
): UpdateWorkspaceResponse!
"""
Confirm invitation to workspace
Returns true if operation is successful
"""
confirmInvitation(
"""
Hash from invitation link
"""
inviteHash: String!
"""
Id of the workspace to which the user was invited
"""
workspaceId: ID!
): UpdateWorkspaceResponse!
"""
Grant admin permissions
Returns true if operation is successful
"""
grantAdmin(
"""
Workspace ID
"""
workspaceId: ID!
"""
ID of user to grant permissions
"""
userId: ID!
"""
Permissions state (true to grant, false to withdraw)
"""
state: Boolean = true
): Boolean! @requireAdmin
"""
Remove member from workspace
Returns true if operation is successful
"""
removeMemberFromWorkspace(
"""
Workspace ID
"""
workspaceId: ID!
"""
ID of user to remove
"""
userId: ID
"""
Email of user to remove
"""
userEmail: String
): Boolean! @requireAdmin
"""
Mutation in order to leave workspace
Returns true if operation is successful
"""
leaveWorkspace(
"""
Workspace ID
"""
workspaceId: ID!
): Boolean!
"""
Update workspace SSO configuration (admin only)
"""
updateWorkspaceSso(
workspaceId: ID!
config: WorkspaceSsoConfigInput!
): Boolean! @requireAdmin
}
`;