From 660ada0b2025eb2c06d9054fd0a7b5a632af6af2 Mon Sep 17 00:00:00 2001 From: Jakob Ankarhem Date: Fri, 22 Jan 2021 16:46:41 +0100 Subject: [PATCH] fix(permissions): use default user permissions when creating a local user (#713) --- server/routes/user.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/routes/user.ts b/server/routes/user.ts index b51b56cd1..2bc715f3b 100644 --- a/server/routes/user.ts +++ b/server/routes/user.ts @@ -21,7 +21,7 @@ router.get('/', async (_req, res) => { router.post('/', async (req, res, next) => { try { - const settings = getSettings().notifications.agents.email; + const settings = getSettings(); const body = req.body; const userRepository = getRepository(User); @@ -29,7 +29,7 @@ router.post('/', async (req, res, next) => { const passedExplicitPassword = body.password && body.password.length > 0; const avatar = gravatarUrl(body.email, { default: 'mm', size: 200 }); - if (!passedExplicitPassword && !settings.enabled) { + if (!passedExplicitPassword && !settings.notifications.agents.email) { throw new Error('Email notifications must be enabled'); } @@ -38,7 +38,7 @@ router.post('/', async (req, res, next) => { username: body.username ?? body.email, email: body.email, password: body.password, - permissions: Permission.REQUEST, + permissions: settings.main.defaultPermissions, plexToken: '', userType: UserType.LOCAL, });