@holeauth/rbac-drizzle
v0.0.1-alpha.0
Published
Drizzle RBAC adapter for @holeauth/plugin-rbac (user-group and user-permission assignments, optional group persistence).
Readme
@holeauth/rbac-drizzle
Drizzle adapter implementation of the RbacAdapter interface from @holeauth/plugin-rbac.
Install
pnpm add @holeauth/rbac-drizzle drizzle-ormUsage (Postgres)
import { createRbacTables, createRbacAdapter } from '@holeauth/rbac-drizzle/pg';
import { users } from '@/db/schema';
export const rbac = createRbacTables({ usersTable: users });
// → tables.userGroups, tables.userPermissions, (tables.groups if persistGroups: true)
const rbacAdapter = createRbacAdapter({ db, tables: rbac.tables });Subpaths: @holeauth/rbac-drizzle/pg | /mysql | /sqlite.
Notes
- Groups themselves are defined in YAML via
@holeauth/rbac-yaml; only user↔group assignments and user↔permission overrides are stored. - Pass
persistGroups: trueto also create agrouptable for admin UIs that want to persist edits. - Cascade-delete from your users table wipes assignments automatically.
