From 8a249b96ac743de2cfc6a08bd3c5cc6c07a75848 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Tue, 9 Jan 2024 22:00:03 +0100 Subject: [PATCH] Add admin role to the admin user on start --- src/back/collections/users.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/back/collections/users.ts b/src/back/collections/users.ts index 330ba4d..cf6b630 100644 --- a/src/back/collections/users.ts +++ b/src/back/collections/users.ts @@ -30,12 +30,13 @@ export default class Users extends Collections.users { "ADMIN", `Creating an admin account for ${app.manifest.admin_email}` ); - await app.collections.users.suCreate({ + const { id } = await app.collections.users.suCreate({ username, password: ADMIN_CREDENTIALS.password, email: ADMIN_CREDENTIALS.email, roles: [], }); + await app.collections["user-roles"].suCreate({ user: id, role: "admin" }); } }); }