-
Notifications
You must be signed in to change notification settings - Fork 4
/
v1.0.yaml
5717 lines (5632 loc) · 222 KB
/
v1.0.yaml
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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.1
info:
title: Libre Graph API
description: Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.
version: v1.0.4
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: https://ocis.ocis.rolling.owncloud.works/graph
description: ownCloud Infinite Scale Rolling Release
- url: https://localhost:9200/graph
description: ownCloud Infinite Scale Development Setup
# commented for now because it is unrelated to the PR but allows describing and linking to external docs
# tags:
# - name: roleManagement
# description: Manage roles and permissions
# externalDocs:
# url: https://owncloud.dev/ocis/roles-and-permissions
paths:
'/v1.0/me':
patch:
tags:
- me.user
summary: Update the current user
operationId: UpdateOwnUser
requestBody:
description: New user values
content:
application/json:
schema:
$ref: '#/components/schemas/userUpdate'
examples:
change preferred language:
value:
preferredLanguage: "en"
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/user'
default:
$ref: '#/components/responses/error'
get:
tags:
- me.user
summary: Get current user
operationId: GetOwnUser
parameters:
- name: $expand
in: query
description: Expand related entities
style: form
explode: false
schema:
uniqueItems: true
type: array
items:
enum:
- memberOf
type: string
responses:
'200':
description: Retrieved entity
content:
application/json:
schema:
$ref: '#/components/schemas/user'
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
/v1.0/me/changePassword:
post:
tags:
- me.changepassword
summary: Change your own password
operationId: ChangeOwnPassword
requestBody:
description: Password change request
content:
application/json:
schema:
title: Password change
type: object
required:
- currentPassword
- newPassword
properties:
currentPassword:
type: string
newPassword:
type: string
required: true
responses:
'204':
description: Success
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/v1beta1/extensions/org.libregraph/activities':
get:
tags:
- activities
summary: Get activities
operationId: GetActivities
parameters:
- in: query
name: kql
schema:
type: string
example: resourceid:a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668 depth:2
responses:
'200':
description: Found activities
content:
application/json:
schema:
title: Collection of activities
type: object
properties:
value:
type: array
items:
$ref: '#/components/schemas/activity'
examples:
item activities:
value:
- id: "34646ab6-be32-43c9-89e6-987e0c237e9b"
times:
recordedTime: "2023-09-14T12:27:15"
template:
message: "{user} shared {resource}"
variables:
user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
resource:
id: "7f92b0a9-06ad-49dc-890f-0e0a6eb4dea6$e9f01ca3-577f-4d1d-acd4-1cc44149ac25!5fb9f87c-a317-467b-9882-eb9f171564ac"
name: "secret stuff"
default:
$ref: '#/components/responses/error'
'/v1beta1/me/drives':
# $ref is buggy in the openapi-generator v7.0.1
# $ref: '#/paths/~1v1.0~1me~1drives'
get:
tags:
- me.drives
summary: Alias for '/v1.0/drives', the difference is that grantedtoV2 is used and roles contain unified roles instead of cs3 roles
operationId: ListMyDrivesBeta
parameters:
- $ref: '#/components/parameters/orderby'
- $ref: '#/components/parameters/drivesFilter'
responses:
'200':
description: Retrieved spaces
content:
application/json:
schema:
title: Collection of drives
type: object
properties:
value:
type: array
items:
$ref: '#/components/schemas/drive'
maxItems: 100
'@odata.nextLink':
type: string
links:
root:
operationId: HomeGetRoot
default:
$ref: '#/components/responses/error'
x-ms-pageable:
nextLinkName: '@odata.nextLink'
operationName: listMore
x-ms-docs-operation-type: operation
/v1.0/me/drives:
get:
tags:
- me.drives
summary: Get all drives where the current user is a regular member of
operationId: ListMyDrives
parameters:
- $ref: '#/components/parameters/orderby'
- $ref: '#/components/parameters/drivesFilter'
responses:
'200':
description: Retrieved spaces
content:
application/json:
schema:
title: Collection of drives
type: object
properties:
value:
type: array
items:
$ref: '#/components/schemas/drive'
maxItems: 100
'@odata.nextLink':
type: string
links:
root:
operationId: HomeGetRoot
default:
$ref: '#/components/responses/error'
x-ms-pageable:
nextLinkName: '@odata.nextLink'
operationName: listMore
x-ms-docs-operation-type: operation
'/v1beta1/drives':
# $ref is buggy in the openapi-generator v7.0.1
# $ref: '#/paths/~1v1.0~1drives'
get:
tags:
- drives.GetDrives
summary: Alias for '/v1.0/drives', the difference is that grantedtoV2 is used and roles contain unified roles instead of cs3 roles
operationId: ListAllDrivesBeta
parameters:
- $ref: '#/components/parameters/orderby'
- $ref: '#/components/parameters/drivesFilter'
responses:
'200':
description: Retrieved spaces
content:
application/json:
schema:
title: Collection of drives
type: object
properties:
value:
type: array
items:
$ref: '#/components/schemas/drive'
links:
root:
operationId: GetRoot
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/v1.0/drives':
get:
tags:
- drives.GetDrives
summary: Get all available drives
operationId: ListAllDrives
parameters:
- $ref: '#/components/parameters/orderby'
- $ref: '#/components/parameters/drivesFilter'
responses:
'200':
description: Retrieved spaces
content:
application/json:
schema:
title: Collection of drives
type: object
properties:
value:
type: array
items:
$ref: '#/components/schemas/drive'
links:
root:
operationId: GetRoot
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
post:
tags:
- drives
summary: Create a new drive of a specific type
operationId: CreateDrive
requestBody:
description: New space property values
content:
application/json:
schema:
$ref: '#/components/schemas/drive'
examples:
multiple values:
value:
name: Mars
quota:
total: 1000000000
description: Team space mars project
minimal:
value:
name: Venus
required: true
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/drive'
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/v1.0/drives/{drive-id}':
get:
tags:
- drives
summary: Get drive by id
operationId: GetDrive
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
x-ms-docs-key-type: drive
responses:
'200':
description: Retrieved drive
content:
application/json:
schema:
$ref: '#/components/schemas/drive'
links:
root:
operationId: GetRoot
parameters:
drive-id: $request.path.drive-id
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
patch:
tags:
- drives
summary: Update the drive
operationId: UpdateDrive
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
x-ms-docs-key-type: drive
requestBody:
description: New space values
content:
application/json:
schema:
$ref: '#/components/schemas/driveUpdate'
examples:
change quota:
value:
quota:
total: 1000000000
change name:
value:
name: Physics
change description:
value:
description: Marketing team collaboration area
change drive image:
value:
special:
id: 408f26e3-d6d8-4aa4-bd5c-3fd6f5032b51$aba2bafc-e1a0-421e-a37a-9acf5f655f83!14fd3432-e8d9-42a7-9446-2e3fd621afca
specialFolder:
name: image
change drive readme:
value:
special:
id: 408f26e3-d6d8-4aa4-bd5c-3fd6f5032b51$aba2bafc-e1a0-421e-a37a-9acf5f655f83!14fd3432-e8d9-42a7-9446-2e3fd621afca
specialFolder:
name: readme
required: true
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/drive'
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
delete:
tags:
- drives
summary: Delete a specific space
operationId: DeleteDrive
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
x-ms-docs-key-type: drive
- name: If-Match
in: header
description: ETag
schema:
type: string
responses:
'204':
description: Success
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/v1beta1/drives/{drive-id}/root/children':
post:
tags:
- drives.root
summary: Create a drive item
operationId: CreateDriveItem
description: |
You can use the root childrens endpoint to mount a remoteItem in the share jail. The `@client.synchronize` property of the `driveItem` in the [sharedWithMe](#/me.drive/ListSharedWithMe) endpoint will change to true.
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
example: a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668
x-ms-docs-key-type: drive
requestBody:
description: In the request body, provide a JSON object with the following parameters. For mounting a share the necessary remoteItem id and permission id can be taken from the [sharedWithMe](#/me.drive/ListSharedWithMe) endpoint.
content:
application/json:
schema:
$ref: '#/components/schemas/driveItem'
examples:
mount a shared remoteId:
value:
name: Einsteins project share
remoteItem:
id: a-storage-provider-id$a-space-id!a-node-id
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/driveItem'
example:
name: Einsteins project share
id: a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668!share-id
remoteItem:
id: a-storage-provider-id$a-space-id!a-node-id
name: Project
parentReference:
driveID: a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668
id: a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668!a0ca6a90-a365-4782-871e-d44447bbc668
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/v1beta1/drives/{drive-id}/root/createLink':
post:
tags:
- drives.root
summary: Create a sharing link for the root item of a Drive
operationId: CreateLinkSpaceRoot
description: |
You can use the createLink action to share a driveItem via a sharing link.
The response will be a permission object with the link facet containing the created link details.
## Link types
For now, The following values are allowed for the type parameter.
| Value | Display name | Description |
| -------------- | ----------------- | --------------------------------------------------------------- |
| view | View | Creates a read-only link to the driveItem. |
| upload | Upload | Creates a read-write link to the folder driveItem. |
| edit | Edit | Creates a read-write link to the driveItem. |
| createOnly | File Drop | Creates an upload-only link to the folder driveItem. |
| blocksDownload | Secure View | Creates a read-only link that blocks download to the driveItem. |
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
x-ms-docs-key-type: drive
requestBody:
description: In the request body, provide a JSON object with the following parameters.
content:
application/json:
schema:
$ref: '#/components/schemas/driveItemCreateLink'
examples:
create viewer link:
value:
type: "view"
create editor link with custom display name:
value:
type: "edit"
displayName: "Homework"
create editor link with expiry:
value:
type: "edit"
expirationDateTime: "2018-07-15T14:00:00.000Z"
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/permission'
examples:
create viewer link:
value:
- id: "7181275c-557e-4adf-8e44-abdcf5389b6a"
link:
type: "view"
webUrl: "https://cloud.example.org/s/YlaySZdHCRHUDeE"
create editor link with custom display name:
value:
- id: "7181275c-557e-4adf-8e44-abdcf5389b6a"
link:
type: "edit"
displayName: "Homework"
webUrl: "https://cloud.example.org/s/fdleMyGeerkIZTJ"
create editor link with expiry:
value:
- id: "a373c812-d786-42ae-a65f-ed87ee4abd49"
link:
type: "edit"
webUrl: "https://cloud.example.org/s/MlnTDkhcBlihNzO"
'207':
# FIXME describe partial success response
description: Partial success response TODO
default:
$ref: '#/components/responses/error'
# TODO add SendNotification errors as per https://learn.microsoft.com/en-us/graph/api/driveitem-invite?view=graph-rest-beta&tabs=http#sendnotification-errors
x-ms-docs-operation-type: operation
'/v1beta1/drives/{drive-id}/root/invite':
post:
tags:
- drives.root
summary: Send a sharing invitation
operationId: InviteSpaceRoot
description: |
Sends a sharing invitation for the root of a `drive`. A sharing invitation provides permissions to the
recipients and optionally sends them an email with a sharing link.
The response will be a permission object with the grantedToV2 property containing the created grant details.
## Roles property values
For now, roles are only identified by a uuid. There are no hardcoded aliases like `read` or `write` because role actions can be completely customized.
# FIXME we should add isBuiltIn and isEnabled to unifiedRoleDefinition so we can use speaking role ids in examples and establish a well defined set of roles.
# By throwing around only uuids we increase the risk of someone choosing an ambiguous or misleading displayname. We will have to define a set of default
# sharing permissions. For those we should use speaking ids.
#
# For now, the following roles are considered built in:
#
# | Role | Value | Description |
# | ------- | ------- | --------------------------------------------------------------------------------------------------------------------- |
# | Viewer | `read` | Provides the ability to read the metadata and contents of the item. |
# | Editor | `write` | Provides the ability to read and modify the metadata and contents of the item. |
# | Manager | `owner` | For project drives this represents the Manager role to mimic ms graph |
#
# More built in roles will be added with a speaking value but clients **MUST** treat the value as an
# opaque identifier as custom roles will be using UUIDs.
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
x-ms-docs-key-type: drive
requestBody:
description: In the request body, provide a JSON object with the following parameters. To create a custom role submit a list of actions instead of roles.
content:
application/json:
schema:
$ref: '#/components/schemas/driveItemInvite'
examples:
send viewer invite:
value:
recipients:
- '@libre.graph.recipient.type': user
objectId: "4c510ada-c86b-4815-8820-42cdf82c3d51"
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
send viewer invite to multiple recipients:
value:
recipients:
- '@libre.graph.recipient.type': user
objectId: "4c510ada-c86b-4815-8820-42cdf82c3d51"
- '@libre.graph.recipient.type': user
objectId: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
send editor invite with expiry:
value:
recipients:
- '@libre.graph.recipient.type': user
objectId: "4c510ada-c86b-4815-8820-42cdf82c3d51"
roles: [ "fb6c3e19-e378-47e5-b277-9732f9de6e21" ]
expirationDateTime: "2018-07-15T14:00:00.000Z"
send manager invite to group:
description: "Sharing with a groups requires setting the @libre.graph.recipient.type annotation."
value:
recipients:
- '@libre.graph.recipient.type': group
objectId: "167cbee2-0518-455a-bfb2-031fe0621e5d"
roles: [ "312c0871-5ef7-4b3a-85b6-0e4074c64049" ]
send invite to user granting custom actions:
description: "A Custom role is just a collection of actions, in this case allowing the user to stat and move driveItems"
value:
recipients:
- objectId: "4c510ada-c86b-4815-8820-42cdf82c3d51"
'@libre.graph.permissions.actions': [ "libre.graph/driveItem/basic/read", "libre.graph/driveItem/path/update" ]
responses:
'200':
description: Response
content:
application/json:
schema:
title: Collection of permissions
type: object
properties:
value:
type: array
items:
$ref: '#/components/schemas/permission'
examples:
send viewer invite:
value:
- id: "34646ab6-be32-43c9-89e6-987e0c237e9b"
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
send viewer invite to multiple recipients:
description: multiple permissions are returned as each has received a dedicated sharing id
value:
- id: "81d5bad3-3eff-410a-a2ea-eda2d14d4474"
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
- id: "b470677e-a7f5-4304-8ef5-f5056a21fff1"
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
grantedToV2:
- user:
id: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"
displayName: "Marie Skłodowska Curie"
send editor invite with expiry:
value:
- id: "453b02be-4ec2-4e7d-b576-09fc153de812"
roles: [ "fb6c3e19-e378-47e5-b277-9732f9de6e21" ]
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
expirationDateTime: "2018-07-15T14:00:00.000Z"
send manager invite to group:
value:
- id: "86765c0d-3905-444a-9b07-76201f8cf7df"
roles: [ "312c0871-5ef7-4b3a-85b6-0e4074c64049" ]
grantedToV2:
- group:
id: "167cbee2-0518-455a-bfb2-031fe0621e5d"
displayName: "Philosophy Haters"
send invite to user granting custom actions:
value:
- id: "c42b5cbd-2d65-42cf-b0b6-fb6d2b762256"
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
'@libre.graph.permissions.actions': [ "libre.graph/driveItem/basic/read", "libre.graph/driveItem/path/update" ]
'207':
# FIXME describe partial success response
description: Partial success response TODO
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/odata.error'
examples:
secureSharingInvalidRequest:
description: If the recipient was given via email, but does not belong to a known user account.
value:
- error:
- code: invalidRequest
message: Some users in the request cannot be invited securely.
innerError:
- code: secureSharingInvalidRequest
date: "2023-09-14T12:27:15"
request-id: b49f582d-9a0f-4731-ab0c-b9e50246ef58
client-request-id: 832c7206-1a40-395c-e0d9-e85649b8b0b0
default:
$ref: '#/components/responses/error'
# TODO add SendNotification errors as per https://learn.microsoft.com/en-us/graph/api/driveitem-invite?view=graph-rest-beta&tabs=http#sendnotification-errors
x-ms-docs-operation-type: operation
'/v1beta1/drives/{drive-id}/root/permissions':
get:
tags:
- drives.root
summary: List the effective permissions on the root item of a drive.
operationId: ListPermissionsSpaceRoot
description: |
The permissions collection includes potentially sensitive information and may not be available for every caller.
* For the owner of the item, all sharing permissions will be returned. This includes co-owners.
* For a non-owner caller, only the sharing permissions that apply to the caller are returned.
* Sharing permission properties that contain secrets (e.g. `webUrl`) are only returned for callers that are able to create the sharing permission.
All permission objects have an `id`. A permission representing
* a link has the `link` facet filled with details.
* a share has the `roles` property set and the `grantedToV2` property filled with the grant recipient details.
# TODO hm, the ms graph api seems to always fill the `roles` property to indicate the actions granted by the link.
# | Value | Display name | Description | role? |
# | -------------- | ----------------- | --------------------------------------------------------------- | -------------- |
# | view | View | Creates a read-only link to the driveItem. | viewer |
# | upload | Upload | Creates a read-write link to the folder driveItem. | uploader |
# | edit | Edit | Creates a read-write link to the driveItem. | editor |
# | createOnly | File Drop | Creates an upload-only link to the folder driveItem. | createOnly |
# | blocksDownload | Secure View | Creates a read-only link that blocks download to the driveItem. | blocksDownload |
# AFAICT we will have to define the actions granted by a link type when we start to implement this
# but e.g. a createOnly role and blocksDownload should not show up in the drop down for sharing files internally ...
# when we need to hardcode this anyway ... we should indicate that by using the buildIn flag ... but how do we prevent some roles from showing up in the internal sharing dialog ...
# for now leave out the roles property and hardcode the actions allowed by the link type
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
x-ms-docs-key-type: drive
- $ref: '#/components/parameters/permissionsFilter'
- $ref: '#/components/parameters/permissionsSelect'
responses:
'200':
description: Retrieved resource
content:
application/json:
schema:
title: Collection of permissions with allowed values
type: object
properties:
'@libre.graph.permissions.roles.allowedValues':
type: array
description: A list of role definitions that can be chosen for the resource.
items:
$ref: '#/components/schemas/unifiedRoleDefinition'
'@libre.graph.permissions.actions.allowedValues':
type: array
description: |
A list of actions that can be chosen for a custom role.
Following the CS3 API we can represent the CS3 permissions by mapping them to driveItem properties or relations like this:
| [CS3 ResourcePermission](https://cs3org.github.io/cs3apis/#cs3.storage.provider.v1beta1.ResourcePermissions) | action | comment |
| ------------------------------------------------------------------------------------------------------------ | ------ | ------- |
| `stat` | `libre.graph/driveItem/basic/read` | `basic` because it does not include versions or trashed items |
| `get_quota` | `libre.graph/driveItem/quota/read` | read only the `quota` property |
| `get_path` | `libre.graph/driveItem/path/read` | read only the `path` property |
| `move` | `libre.graph/driveItem/path/update` | allows updating the `path` property of a CS3 resource |
| `delete` | `libre.graph/driveItem/standard/delete` | `standard` because deleting is a common update operation |
| `list_container` | `libre.graph/driveItem/children/read` | |
| `create_container` | `libre.graph/driveItem/children/create` | |
| `initiate_file_download` | `libre.graph/driveItem/content/read` | `content` is the property read when initiating a download |
| `initiate_file_upload` | `libre.graph/driveItem/upload/create` | `uploads` are a separate property. postprocessing creates the `content` |
| `add_grant` | `libre.graph/driveItem/permissions/create` | |
| `list_grant` | `libre.graph/driveItem/permissions/read` | |
| `update_grant` | `libre.graph/driveItem/permissions/update` | |
| `remove_grant` | `libre.graph/driveItem/permissions/delete` | |
| `deny_grant` | `libre.graph/driveItem/permissions/deny` | uses a non CRUD action `deny` |
| `list_file_versions` | `libre.graph/driveItem/versions/read` | `versions` is a `driveItemVersion` collection |
| `restore_file_version` | `libre.graph/driveItem/versions/update` | the only `update` action is restore |
| `list_recycle` | `libre.graph/driveItem/deleted/read` | reading a driveItem `deleted` property implies listing |
| `restore_recycle_item` | `libre.graph/driveItem/deleted/update` | the only `update` action is restore |
| `purge_recycle` | `libre.graph/driveItem/deleted/delete` | allows purging deleted `driveItems` |
items:
type: string
value:
type: array
items:
$ref: '#/components/schemas/permission'
# maxItems: 100
#'@odata.nextLink':
# type: string
example:
'@libre.graph.permissions.roles.allowedValues':
- id: b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5
description: "Allows reading the shared file or folder"
displayName: Viewer
# we don't want to reproduce all the individual role permissions, that is what the /roleManagement/permissions/roleDefinitions endpoint is for
# to build a custom role
#rolePermissions:
# - allowedResourceActions:
# - libre.graph/driveItem/basic/read
# - libre.graph/driveItem/permissions/read
# - libre.graph/driveItem/upload/create
# condition: "exists @Resource.File"
'@libre.graph.weight': 1
- id: fb6c3e19-e378-47e5-b277-9732f9de6e21
description: "Allows reading and writing the shared file or folder"
displayName: Editor
#rolePermissions:
# - allowedResourceActions:
# - libre.graph/driveItem/standard/allTasks
# condition: "exists @Resource.File"
'@libre.graph.weight': 2
- id: 312c0871-5ef7-4b3a-85b6-0e4074c64049
description: "Allows managing a space"
displayName: Manager
#rolePermissions:
# - allowedResourceActions:
# - libre.graph/drive/standard/allTasks
# condition: "exists @Resource.File"
'@libre.graph.weight': 3
- id: 4916f47e-66d5-49bb-9ac9-748ad00334b
description: "Allows creating new files"
displayName: File Drop
#rolePermissions:
# - allowedResourceActions:
# libre.graph/driveItem/upload/create
# condition: "exists @Resource.File"
'@libre.graph.weight': 4
'@libre.graph.permissions.actions.allowedValues': [
"libre.graph/driveItem/basic/read",
"libre.graph/driveItem/permissions/read",
"libre.graph/driveItem/upload/create",
"libre.graph/driveItem/standard/allTasks",
"libre.graph/driveItem/upload/create"
]
value:
- id: "67445fde-a647-4dd4-b015-fc5dafd2821d"
link:
type: "view"
webUrl: "https://cloud.example.org/s/fhGBMIkKFEHWysj"
- id: "34646ab6-be32-43c9-89e6-987e0c237e9b"
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
- id: "81d5bad3-3eff-410a-a2ea-eda2d14d4474"
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
- id: "b470677e-a7f5-4304-8ef5-f5056a21fff1"
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
grantedToV2:
- user:
id: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"
displayName: "Marie Skłodowska Curie"
- id: "453b02be-4ec2-4e7d-b576-09fc153de812"
roles: [ "fb6c3e19-e378-47e5-b277-9732f9de6e21" ]
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
expirationDateTime: "2018-07-15T14:00:00.000Z"
- id: "86765c0d-3905-444a-9b07-76201f8cf7df"
roles: [ "312c0871-5ef7-4b3a-85b6-0e4074c64049" ]
grantedToV2:
- group:
id: "167cbee2-0518-455a-bfb2-031fe0621e5d"
displayName: "Philosophy Haters"
- id: "c42b5cbd-2d65-42cf-b0b6-fb6d2b762256"
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
'@libre.graph.permissions.actions': [ "libre.graph/driveItem/basic/read", "libre.graph/driveItem/path/update" ]
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
'/v1beta1/drives/{drive-id}/root/permissions/{perm-id}':
get:
tags:
- drives.root
summary: Get a single sharing permission for the root item of a drive
operationId: GetPermissionSpaceRoot
description: |
Return the effective sharing permission for a particular permission resource.
# TODO do we need to implement inherited permissions from the start?
# Effective permissions of an item can come from two sources: permissions set directly on the item itself or permissions that are inherited from the item's ancestors.
#
# Callers can differentiate if the permission is inherited or not by checking the `inheritedFrom` property. This property is an ItemReference resource referencing the ancestor that the permission is inherited from.
#
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
x-ms-docs-key-type: drive
- name: perm-id
in: path
description: 'key: id of permission'
required: true
schema:
type: string
x-ms-docs-key-type: permission
responses:
'200':
description: Retrieved resource
content:
application/json:
schema:
$ref: '#/components/schemas/permission'
examples:
edit permission:
value:
id: "81d5bad3-3eff-410a-a2ea-eda2d14d4474"
roles: [ "write" ]
grantedToV2:
- user:
id: "4c510ada-c86b-4815-8820-42cdf82c3d51"
displayName: "Albert Einstein"
default:
$ref: '#/components/responses/error'
x-ms-docs-operation-type: operation
patch:
tags:
- drives.root
summary: Update sharing permission
operationId: UpdatePermissionSpaceRoot
description: |
Update the properties of a sharing permission by patching the permission resource.
Only the `roles`, `expirationDateTime` and `password` properties can be modified this way.
parameters:
- name: drive-id
in: path
description: 'key: id of drive'
required: true
schema:
type: string
x-ms-docs-key-type: drive
- name: perm-id
in: path
description: 'key: id of permission'
required: true
schema:
type: string
x-ms-docs-key-type: permission
#- name: If-Match
# in: header
# description: |
# If this request header is included and the eTag (or cTag) provided does not match the current tag on the item,
# a `412 Precondition Failed`` response is returned and the item will not be updated.
# schema:
# type: string
requestBody:
description: New property values
content:
application/json:
schema:
$ref: '#/components/schemas/permission'
examples:
update link:
description: Updating a public link is done by setting the `type` property of the permission link.
value:
link:
type: edit
update invite:
description: Updating an invite is done by setting the `roles` property of the permission.
value:
roles: [ "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" ]
required: true
responses:
'200':
description: Updated permission
content:
application/json:
schema:
$ref: '#/components/schemas/permission'
examples:
update link:
value:
id: "a373c812-d786-42ae-a65f-ed87ee4abd49"
link:
type: "edit"
webUrl: "https://cloud.example.org/s/MlnTDkhcBlihNzO"
update invite:
value:
id: "81d5bad3-3eff-410a-a2ea-eda2d14d4474"