Scope My shifts at the upstream, and give Route and NavNode one gate declaration
CI / full-gate (push) Successful in 2m56s

This commit is contained in:
2026-09-02 08:15:08 +02:00
parent 8da75b4ca7
commit c7e6d66750
9 changed files with 51 additions and 32 deletions
+4 -2
View File
@@ -5,10 +5,12 @@ import type { User } from "../http/context.ts";
// Widest first: whoever passes an earlier gate passes it without holding anything.
const GATES = ["public", "session", "permission"] as const;
// A route or nav node names exactly one of these; discovery refuses two. Omitting all three is the
// same as `public`, which is why stating it outright makes an open gate a choice, not an oversight.
export interface Gate {
permission?: string | undefined; // the Keto Permission the caller must hold
permission?: string | undefined; // the Keto Permission the caller must hold, `<resource>:<action>`
public?: boolean | undefined; // anyone, signed in or not
session?: boolean | undefined; // any signed-in user, no grant needed
session?: boolean | undefined; // any signed-in user, no grant to hold; anonymous is sent to /login
}
export function allows(gate: Gate, user: User | null): boolean {