@@ -676,10 +676,63 @@ drive.
676676The following routes manage share-by-link permissions scoped to files inside a
677677shared drive:
678678
679+ - ` GET /sharings/drives/:id/permissions?ids=... `
679680- ` POST /sharings/drives/:id/permissions `
680681- ` PATCH /sharings/drives/:id/permissions/:perm-id `
681682- ` DELETE /sharings/drives/:id/permissions/:perm-id `
682683
684+ ### GET /sharings/drives/: id /permissions?ids=...
685+
686+ Lists the share-by-link permissions for the requested file or folder IDs inside
687+ the shared drive.
688+
689+ Authorization rules:
690+
691+ - The shared-drive owner can list all matching links.
692+ - A write-capable recipient can list writable and read-only links.
693+ - A read-only recipient only sees read-only links.
694+
695+ Validation:
696+
697+ - ` ids ` is required and must be a comma-separated list of file or folder IDs.
698+ - Every requested ID must belong to the shared drive.
699+
700+ Status codes:
701+
702+ - ` 200 OK ` listed
703+ - ` 403 Forbidden ` caller cannot access shared-drive permissions
704+ - ` 422 Unprocessable Entity ` missing or invalid ` ids `
705+
706+ ### POST /sharings/drives/: id /permissions
707+
708+ Creates a share-by-link permission for one file or folder in the shared drive.
709+ The request body uses the same JSON: API shape as [ ` POST /permissions ` ] ( permissions.md#post-permissions ) .
710+
711+ Authorization rules:
712+
713+ - The shared-drive owner can create a link.
714+ - A write-capable recipient can create a link.
715+ - A read-only recipient cannot create a link.
716+
717+ Validation:
718+
719+ - The permission set must target exactly one file or folder.
720+ - The target type must be ` io.cozy.files ` .
721+ - Selectors are not supported.
722+ - The target must belong to the shared drive and must be readable by the
723+ caller.
724+ - Only one share-by-link permission can exist per target. A second creation
725+ attempt on the same target returns a conflict, regardless of which member
726+ created the existing link.
727+
728+ Status codes:
729+
730+ - ` 200 OK ` created
731+ - ` 400 Bad Request ` invalid permission set or invalid target
732+ - ` 403 Forbidden ` caller lacks access to the target or is read-only on the
733+ shared drive
734+ - ` 409 Conflict ` a share-by-link permission already exists for this target
735+
683736### PATCH /sharings/drives/: id /permissions/: perm-id
684737
685738Updates an existing share-by-link permission.
@@ -696,12 +749,19 @@ Allowed updates:
696749
697750- ` password `
698751- ` expires_at `
752+ - ` permissions ` (same target only)
699753
700754Validation:
701755
702756- ` password ` must be a string (empty string clears the password).
703757- ` expires_at ` must be a string (empty string clears expiration, otherwise
704758 RFC3339 date-time).
759+ - ` permissions ` , when provided, must still target the same file or folder
760+ inside the shared drive.
761+ - A write-capable creator or the owner can promote a read-only link to a
762+ writable link if their current token grants those verbs.
763+ - A read-only shared-drive recipient cannot patch a permission set to add
764+ writable verbs.
705765
706766Status codes:
707767
@@ -721,6 +781,7 @@ Authorization rules:
721781- The shared-drive owner can revoke any share-by-link permission.
722782- The creator of a share-by-link permission can revoke the permission they
723783 created.
784+ - A read-only shared-drive recipient cannot revoke a permission.
724785- Public share tokens (` share ` , ` share-preview ` ) cannot revoke permissions.
725786
726787Status codes:
@@ -731,6 +792,23 @@ Status codes:
731792 to this shared drive
732793- ` 404 Not Found ` permission ID does not exist
733794
795+ ## Delegated email sharing
796+
797+ Members of a shared drive add new recipients through the sharing API, not
798+ through a drive-specific route:
799+
800+ - ` POST /sharings/:sharing-id/recipients `
801+
802+ When that request is sent from a recipient Cozy, the stack delegates the
803+ operation to the owner Cozy internally.
804+
805+ Authorization rules:
806+
807+ - The shared-drive owner can add recipients as for any other sharing.
808+ - A write-capable recipient can invite read-write or read-only recipients.
809+ - A read-only recipient can invite only read-only recipients.
810+ - A read-only recipient receives ` 403 Forbidden ` for a read-write invite.
811+
734812
735813## Versions
736814
0 commit comments