Permission module: effective visibility and permissions (#7) #20

Merged
miko merged 2 commits from feature/7-permissions into development 2026-11-01 18:34:40 +01:00
Owner

Closes #7.

One module, src/permissions/permissions.ts, answers who may see or do what with a guide or category (ADR-0002, ADR-0003):

  • effectiveVisibility, canViewCategory, canViewGuide (drafts only for editors, deleted guides for nobody)
  • canEditGuide covers every owner capability: edit, publish, visibility, delete, wiki mode
  • canCreateGuide, isAdmin, canManageCategories, canTransferOwnership, canRestoreGuides

The category tree, the admin shortcuts and requireAdmin now go through it. Vitest covers every rule from the ticket, including an owner who lost the author role and an internal ancestor above a public guide.

🤖 Generated with Claude Code

Closes #7. One module, `src/permissions/permissions.ts`, answers who may see or do what with a guide or category (ADR-0002, ADR-0003): - `effectiveVisibility`, `canViewCategory`, `canViewGuide` (drafts only for editors, deleted guides for nobody) - `canEditGuide` covers every owner capability: edit, publish, visibility, delete, wiki mode - `canCreateGuide`, `isAdmin`, `canManageCategories`, `canTransferOwnership`, `canRestoreGuides` The category tree, the admin shortcuts and `requireAdmin` now go through it. Vitest covers every rule from the ticket, including an owner who lost the author role and an internal ancestor above a public guide. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Pure functions answering who may see or do what with a guide or category
(ADR-0002, ADR-0003). The category tree and admin shortcuts use them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deleted guides are not editable; isAdmin and RoleActor are exported and
used by requireAdmin and the category tree; more edge-case tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miko merged commit 05caa33dd9 into development 2026-11-01 18:34:40 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MassiveDynamic/kataba!20
No description provided.