feat: add authorization bootstrap and HTTP enforcement
Wires Core's identity and authorization domains into apps/api over one shared, validated PostgreSQL pool; adds an explicit, single-use, concurrency-safe platform-owner bootstrap CLI; adds a smallest-possible immutable permission registry with one Core-owned restricted permission (core.authorization.grants.manage); and adds reusable Hono authorization enforcement plus a narrowly scoped /api/v1/grants HTTP API for managing explicit grants only, gated by an exact trusted Origin on every mutation.
This commit is contained in:
@@ -105,3 +105,14 @@ export function createAuthorizationDrizzleDatabase(
|
||||
db,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* A typed Drizzle view over an externally owned pool — for example one shared with the identity
|
||||
* schema via `createValidatedPostgresPool` (`core/src/database/pool.ts`). Unlike
|
||||
* `createAuthorizationDrizzleDatabase`, this function never constructs, registers an error
|
||||
* listener on, or closes a pool itself: the caller retains that responsibility exactly once,
|
||||
* regardless of how many typed views it creates over the same pool.
|
||||
*/
|
||||
export function createAuthorizationDrizzleView(pool: Pool): AuthorizationDrizzleDatabase {
|
||||
return drizzle(pool, { schema: authorizationSchema });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user