Skip to content

Commit b591ccd

Browse files
authored
feat: Allow read-only shared-drive members to create read-only share-by-link permissions (#4698)
The previous behavior was too strict: read-only members could already see existing read-only links, but they were blocked from creating the same kind of link themselves. The change only allows read-only link creation, while still forbidding read-only members from modifying or revoking share-by-link permissions afterward.
2 parents 4733d41 + c2144a1 commit b591ccd

File tree

4 files changed

+557
-121
lines changed

4 files changed

+557
-121
lines changed

docs/shared-drives.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ Authorization rules:
778778

779779
- The shared-drive owner can create a link.
780780
- A write-capable recipient can create a link.
781-
- A read-only recipient cannot create a link.
781+
- A read-only recipient can create a read-only link.
782782

783783
Validation:
784784

@@ -787,6 +787,7 @@ Validation:
787787
- Selectors are not supported.
788788
- The target must belong to the shared drive and must be readable by the
789789
caller.
790+
- A read-only recipient cannot request writable verbs.
790791
- Only one share-by-link permission can exist per target. A second creation
791792
attempt on the same target returns a conflict, regardless of which member
792793
created the existing link.
@@ -795,8 +796,8 @@ Status codes:
795796

796797
- `200 OK` created
797798
- `400 Bad Request` invalid permission set or invalid target
798-
- `403 Forbidden` caller lacks access to the target or is read-only on the
799-
shared drive
799+
- `403 Forbidden` caller lacks access to the target or requests a permission
800+
set larger than their shared-drive access
800801
- `409 Conflict` a share-by-link permission already exists for this target
801802

802803
### PATCH /sharings/drives/:id/permissions/:perm-id
@@ -809,13 +810,15 @@ Authorization rules:
809810
- The creator of a share-by-link permission can patch the permission they
810811
created.
811812
- Creator resolution works for same-stack and cross-stack recipients.
813+
- A read-only shared-drive recipient can patch only the read-only permission
814+
they created.
812815
- Public share tokens (`share`, `share-preview`) cannot patch permissions.
813816

814817
Allowed updates:
815818

816819
- `password`
817820
- `expires_at`
818-
- `permissions` (same target only)
821+
- `permissions` (same target only, owner or write-capable creator only)
819822

820823
Validation:
821824

@@ -826,16 +829,19 @@ Validation:
826829
inside the shared drive.
827830
- A write-capable creator or the owner can promote a read-only link to a
828831
writable link if their current token grants those verbs.
829-
- A read-only shared-drive recipient cannot patch a permission set to add
830-
writable verbs.
832+
- A read-only shared-drive recipient can only update `password` and
833+
`expires_at`.
834+
- A read-only shared-drive recipient cannot patch `permissions`, even if the
835+
result would stay read-only.
831836

832837
Status codes:
833838

834839
- `200 OK` updated
835-
- `400 Bad Request` invalid payload (for example trying to update `permissions`
836-
or `codes`), invalid `password` / `expires_at` attribute format
837-
- `403 Forbidden` caller is not owner/creator, or caller identity cannot be
838-
verified for a shared-drive token
840+
- `400 Bad Request` invalid payload (for example trying to update `codes`),
841+
invalid `password` / `expires_at` attribute format
842+
- `403 Forbidden` caller is not owner/creator, caller identity cannot be
843+
verified for a shared-drive token, or a read-only recipient attempts to
844+
patch `permissions`
839845
- `404 Not Found` permission ID does not exist
840846

841847
### DELETE /sharings/drives/:id/permissions/:perm-id
@@ -847,7 +853,8 @@ Authorization rules:
847853
- The shared-drive owner can revoke any share-by-link permission.
848854
- The creator of a share-by-link permission can revoke the permission they
849855
created.
850-
- A read-only shared-drive recipient cannot revoke a permission.
856+
- A read-only shared-drive recipient can revoke the read-only permission they
857+
created.
851858
- Public share tokens (`share`, `share-preview`) cannot revoke permissions.
852859

853860
Status codes:

0 commit comments

Comments
 (0)