From 0c5b4c756f682ad8801aed13aa40071df4f4cb7a Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 28 Jun 2025 01:25:43 +0200 Subject: [PATCH] Make the first user created an admin To easily bootstrap of administration of the system make the first regular user account created into an admin account. --- server/api/auth/account.post.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/api/auth/account.post.ts b/server/api/auth/account.post.ts index 3c5b822..30caba0 100644 --- a/server/api/auth/account.post.ts +++ b/server/api/auth/account.post.ts @@ -29,10 +29,11 @@ export default defineEventHandler(async (event) => { }); } + const firstUser = users.every(user => user.type === "anonymous"); user = { id: await nextUserId(), updatedAt: new Date().toISOString(), - type: "regular", + type: firstUser ? "admin" : "regular", name, };