mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-26 17:54:44 +10:00
feat: introduction of 'system user'
This commit is contained in:
@@ -12,4 +12,28 @@ export default defineNitroPlugin(async (nitro) => {
|
|||||||
nitro.hooks.hookOnce("close", async () => {
|
nitro.hooks.hookOnce("close", async () => {
|
||||||
await applicationSettings.waitForWrite();
|
await applicationSettings.waitForWrite();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Ensure system user exists
|
||||||
|
// The system user owns any user-based code
|
||||||
|
// that we want to re-use for the app
|
||||||
|
// e.g. notifications
|
||||||
|
await prisma.user.upsert({
|
||||||
|
where: {
|
||||||
|
id: "system",
|
||||||
|
},
|
||||||
|
create: {
|
||||||
|
id: "system",
|
||||||
|
admin: true,
|
||||||
|
|
||||||
|
displayName: "System",
|
||||||
|
username: "system",
|
||||||
|
email: "system@drop",
|
||||||
|
profilePicture: "",
|
||||||
|
},
|
||||||
|
update: {
|
||||||
|
admin: true,
|
||||||
|
authMecs: { set: [] },
|
||||||
|
clients: { set: [] },
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -5,6 +5,7 @@ export default defineNitroPlugin(async (nitro) => {
|
|||||||
if (userCount != 0) return;
|
if (userCount != 0) return;
|
||||||
|
|
||||||
// This setup runs every time the server sets up,
|
// This setup runs every time the server sets up,
|
||||||
|
// but has not been configured
|
||||||
// so it should be in-place
|
// so it should be in-place
|
||||||
|
|
||||||
// Create admin invitation
|
// Create admin invitation
|
||||||
@@ -15,12 +16,10 @@ export default defineNitroPlugin(async (nitro) => {
|
|||||||
create: {
|
create: {
|
||||||
id: "admin",
|
id: "admin",
|
||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
expires: new Date('4096-01-01')
|
expires: new Date("4096-01-01"),
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user