ability to remove user from org

This commit is contained in:
Milo Schwartz 2024-11-03 17:28:12 -05:00
parent 2852d62258
commit fadfaf1f0b
No known key found for this signature in database
28 changed files with 718 additions and 264 deletions

View file

@ -15,7 +15,7 @@ export async function ensureActions() {
const defaultRoles = await db
.select()
.from(roles)
.where(eq(roles.isSuperuserRole, true))
.where(eq(roles.isSuperUserRole, true))
.execute();
// Add new actions
@ -38,15 +38,15 @@ export async function ensureActions() {
}
}
export async function createSuperuserRole(orgId: string) {
export async function createSuperUserRole(orgId: string) {
// Create the Default role if it doesn't exist
const [insertedRole] = await db
.insert(roles)
.values({
orgId,
isSuperuserRole: true,
name: 'Superuser',
description: 'Superuser role with all actions'
isSuperUserRole: true,
name: 'Super User',
description: 'Super User role with all actions'
})
.returning({ roleId: roles.roleId })
.execute();
@ -56,7 +56,7 @@ export async function createSuperuserRole(orgId: string) {
const actionIds = await db.select().from(actions).execute();
if (actionIds.length === 0) {
logger.info('No actions to assign to the Superuser role');
logger.info('No actions to assign to the Super User role');
return;
}

View file

@ -131,7 +131,7 @@ export const roles = sqliteTable("roles", {
orgId: text("orgId").references(() => orgs.orgId, {
onDelete: "cascade",
}),
isSuperuserRole: integer("isSuperuserRole", { mode: "boolean" }),
isSuperUserRole: integer("isSuperUserRole", { mode: "boolean" }),
name: text("name").notNull(),
description: text("description"),
});