mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-29 06:08:15 +02:00
Fix out of order superuser role
This commit is contained in:
parent
8c5572dd13
commit
d54cf34377
2 changed files with 7 additions and 9 deletions
|
@ -11,6 +11,7 @@ const environmentSchema = z.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
environment: z.enum(["dev", "prod"]),
|
environment: z.enum(["dev", "prod"]),
|
||||||
base_url: z.string().url(),
|
base_url: z.string().url(),
|
||||||
|
base_domain: z.string(),
|
||||||
log_level: z.enum(["debug", "info", "warn", "error"]),
|
log_level: z.enum(["debug", "info", "warn", "error"]),
|
||||||
save_logs: z.string().transform((val) => val === "true"),
|
save_logs: z.string().transform((val) => val === "true"),
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -18,18 +18,15 @@ export async function ensureActions() {
|
||||||
.where(eq(roles.isSuperuserRole, true))
|
.where(eq(roles.isSuperuserRole, true))
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
if (defaultRoles.length === 0) {
|
|
||||||
logger.info('No default roles to assign');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new actions
|
// Add new actions
|
||||||
for (const actionId of actionsToAdd) {
|
for (const actionId of actionsToAdd) {
|
||||||
await db.insert(actions).values({ actionId }).execute();
|
await db.insert(actions).values({ actionId }).execute();
|
||||||
// Add new actions to the Default role
|
// Add new actions to the Default role
|
||||||
await db.insert(roleActions)
|
if (defaultRoles.length === 0) {
|
||||||
.values(defaultRoles.map(role => ({ roleId: role.roleId!, actionId, orgId: role.orgId! })))
|
await db.insert(roleActions)
|
||||||
.execute();
|
.values(defaultRoles.map(role => ({ roleId: role.roleId!, actionId, orgId: role.orgId! })))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove deprecated actions
|
// Remove deprecated actions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue