feat(users): add ability to disable users without deleting them

- Add disabled boolean field to user schema (PostgreSQL, MySQL, SQLite)
- Block disabled users from logging in via any auth provider (credentials, LDAP, OIDC)
- Check disabled status in session callback to prevent session replay
- Add changeDisabled API endpoint (admin-only)
- Include disabled field in getById and getAll user endpoints
- Add disable/enable user toggle in admin UI with status badge in user list
This commit is contained in:
ajnart committed 2026-07-06 02:55:39 +02:00
1 parent a55dc98487
commit 4ff2c9a7fb
13 files changed
+125 -1

No files matched your search

@@ -0,0 +1 @@
ALTER TABLE `user` ADD `disabled` boolean DEFAULT false NOT NULL;
@@ -0,0 +1 @@
ALTER TABLE "user" ADD COLUMN "disabled" boolean DEFAULT false NOT NULL;
@@ -0,0 +1 @@
ALTER TABLE "user" ADD COLUMN "disabled" integer DEFAULT 0 NOT NULL;
+1
View File
@@ -72,6 +72,7 @@ export const users = mysqlTable("user", {
image: text(),
password: text(),
provider: varchar({ length: 64 }).$type<SupportedAuthProvider>().default("credentials").notNull(),
disabled: boolean().default(false).notNull(),
homeBoardId: varchar({ length: 64 }).references((): AnyMySqlColumn => boards.id, {
onDelete: "set null",
}),
+1
View File
@@ -71,6 +71,7 @@ export const users = pgTable("user", {
image: text(),
password: text(),
provider: varchar({ length: 64 }).$type<SupportedAuthProvider>().default("credentials").notNull(),
disabled: boolean().default(false).notNull(),
homeBoardId: varchar({ length: 64 }).references((): AnyPgColumn => boards.id, {
onDelete: "set null",
}),
+1
View File
@@ -54,6 +54,7 @@ export const users = sqliteTable("user", {
image: text(),
password: text(),
provider: text().$type<SupportedAuthProvider>().default("credentials").notNull(),
disabled: int({ mode: "boolean" }).default(false).notNull(),
homeBoardId: text().references((): AnySQLiteColumn => boards.id, {
onDelete: "set null",
}),