Skip to content

OBJ-96 — Permission grants (viewer/commenter/editor) - #37

Merged
objectgyan merged 1 commit into
mainfrom
objectgyan/obj-96-m9b1-permission-grants-viewer-commenter-editor
May 17, 2026
Merged

objectgyan merged 1 commit into
mainfrom
objectgyan/obj-96-m9b1-permission-grants-viewer-commenter-editor

Conversation

@objectgyan

Copy link
Copy Markdown
Owner

Summary

  • Adds document_shares table with role-check constraint (viewer, commenter, editor) and created_by column on documents
  • Implements three endpoints: POST /api/documents/{id}/shares (201), GET /api/documents/{id}/shares (200), DELETE /api/documents/{id}/shares/{shareId} (204)
  • Owner-only authorization via IAuthorizationPolicy.AuthorizeAsync(userId, document, AuthorizationAction.Share); non-owner → 403

Test plan

  • Build passes (0 warnings, 0 errors)
  • 159 unit tests pass
  • 97 integration tests pass (includes 8 new ShareApiTests)
  • scripts/validate-obj-96.ps1 exits 0 — full grant/list/revoke cycle verified live + DB
  • validation/obj-96-db.txt — DB row presence/absence confirmed
  • validation/obj-96-api.txt — all API assertions logged

Adds document_shares table with role-check constraint (viewer/commenter/editor),
owner-only IAuthorizationPolicy Share action authz, and three endpoints:
POST /api/documents/{id}/shares (201), GET (200), DELETE (204).
Adds created_by column to documents for ownership tracking.
Migration: AddDocumentShares. Tests: 97 integration + 159 unit, all passing.
@objectgyan
objectgyan merged commit c101320 into main May 17, 2026
@linear-code

linear-code Bot commented May 17, 2026

Copy link
Copy Markdown
OBJ-96 M9b.1 — Permission grants (viewer / commenter / editor)

Milestone: M9 · Wave: 3

Summary

Add document_shares table with (document_id, grantee_user_id, role). APIs: grant/revoke/list. Role enum: viewer | commenter | editor.

Acceptance

  • Migration + indexes
  • POST/DELETE/GET endpoints
  • Tenant-scoped + authz enforced (only owner can grant)

Validation

  • DB check: round-trip grant + revoke reflected in document_shares
  • Live API check: curl grant → 201; list → 200; revoke → 204
  • Script: scripts/validate-obj-NNN.ps1

Branch / PR

Branch from main; target main. No trailers/footer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant