Add isSuperAdmin account

This commit is contained in:
jeffvli 2022-11-08 18:40:44 -08:00
parent 3bc0ea16bc
commit df8e38cedd
5 changed files with 15 additions and 9 deletions

View File

@ -603,6 +603,7 @@ const users = (
refreshToken: item.refreshToken,
enabled: item.enabled,
isAdmin: item.isAdmin,
isSuperAdmin: item.isSuperAdmin,
deviceId: item.deviceId,
createdAt: item.createdAt,
updatedAt: item.updatedAt,

View File

@ -57,6 +57,7 @@ export const authenticate = (
flatServerPermissions,
id: user?.id,
isAdmin: user?.isAdmin,
isSuperAdmin: user?.isSuperAdmin,
server: req.params.serverId,
serverFolderPermissions: user?.serverFolderPermissions,
serverPermissions: user?.serverPermissions,

View File

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "isSuperAdmin" BOOLEAN NOT NULL DEFAULT false;

View File

@ -57,15 +57,16 @@ model RefreshToken {
}
model User {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
displayName String? @unique
username String @unique
password String
enabled Boolean @default(false)
isAdmin Boolean @default(false)
deviceId String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
displayName String? @unique
username String @unique
password String
enabled Boolean @default(false)
isAdmin Boolean @default(false)
isSuperAdmin Boolean @default(false)
deviceId String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
histories History[]
albumArtistRatings AlbumArtistRating[]

View File

@ -15,6 +15,7 @@ async function main() {
deviceId: `admin_${randomString(10)}`,
enabled: true,
isAdmin: true,
isSuperAdmin: true,
password: hashedPassword,
username: 'admin',
},