docs(permissions): note requireWriteAll can replace the inline guard elsewhere
Some checks failed
CI / Semgrep Security Scan (pull_request) Successful in 25s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m6s
SDD Gate / RTM Check (pull_request) Successful in 14s
SDD Gate / Contract Validate (pull_request) Successful in 23s
SDD Gate / Constitution Impact (pull_request) Successful in 21s
CI / Unit & Component Tests (pull_request) Failing after 3m19s
CI / OCR Service Tests (pull_request) Successful in 22s
CI / Backend Unit Tests (pull_request) Successful in 4m49s
CI / fail2ban Regex (pull_request) Successful in 47s
Some checks failed
CI / Semgrep Security Scan (pull_request) Successful in 25s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m6s
SDD Gate / RTM Check (pull_request) Successful in 14s
SDD Gate / Contract Validate (pull_request) Successful in 23s
SDD Gate / Constitution Impact (pull_request) Successful in 21s
CI / Unit & Component Tests (pull_request) Failing after 3m19s
CI / OCR Service Tests (pull_request) Successful in 22s
CI / Backend Unit Tests (pull_request) Successful in 4m49s
CI / fail2ban Regex (pull_request) Successful in 47s
Architect/Developer review suggestion: flag that other WRITE_ALL-gated author loads (e.g. documents/[id]/edit) still inline the throw-403 guard and can adopt requireWriteAll so it doesn't diverge. Comment-only. Addresses PR #832 review (Architect suggestion). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,10 @@ export function hasWriteAll(locals: PermissionLocals): boolean {
|
|||||||
* — `hasWriteAll` returns false for a null user, so a single check covers both
|
* — `hasWriteAll` returns false for a null user, so a single check covers both
|
||||||
* the unauthenticated and the under-privileged case. Server-side gate; the
|
* the unauthenticated and the under-privileged case. Server-side gate; the
|
||||||
* frontend canWrite flag only hides entry-point buttons.
|
* frontend canWrite flag only hides entry-point buttons.
|
||||||
|
*
|
||||||
|
* Other WRITE_ALL-gated author loads (e.g. `documents/[id]/edit`) still inline
|
||||||
|
* `if (!hasWriteAll(locals)) throw error(403)` — they can adopt this helper so
|
||||||
|
* the guard doesn't quietly diverge across routes.
|
||||||
*/
|
*/
|
||||||
export function requireWriteAll(locals: PermissionLocals): void {
|
export function requireWriteAll(locals: PermissionLocals): void {
|
||||||
if (!hasWriteAll(locals)) throw error(403, 'Forbidden');
|
if (!hasWriteAll(locals)) throw error(403, 'Forbidden');
|
||||||
|
|||||||
Reference in New Issue
Block a user