Grant a permission on a file (ASK-122)
POST/files/:file_id/grants
Creates a new file_grants row scoped to (file_id, grantee_type, grantee_id, permission). Only the file owner may create grants.
The grantee_id is validated against the corresponding table: users for grantee_type=user, courses for course, and study_guides (filtered by deleted_at IS NULL) for study_guide. The public sentinel UUID 00000000-0000-0000-0000-000000000000 is exempt from the users lookup when grantee_type=user (represents "public access").
A duplicate grant returns 409 Conflict; this endpoint does NOT upsert. Permission hierarchy (delete >= share >= view) is enforced by the read-side queries, not here.
Request
Responses
- 201
- 400
- 401
- 403
- 404
- 409
- 500
Grant created
Bad request
Unauthorized
Forbidden
Not found
Conflict with current resource state
Internal server error