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.
This commit is contained in:
parent
e5e923bc8d
commit
0c5b4c756f
1 changed files with 2 additions and 1 deletions
|
@ -29,10 +29,11 @@ export default defineEventHandler(async (event) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const firstUser = users.every(user => user.type === "anonymous");
|
||||||
user = {
|
user = {
|
||||||
id: await nextUserId(),
|
id: await nextUserId(),
|
||||||
updatedAt: new Date().toISOString(),
|
updatedAt: new Date().toISOString(),
|
||||||
type: "regular",
|
type: firstUser ? "admin" : "regular",
|
||||||
name,
|
name,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue