fix(permissions): use default user permissions when creating a local user (#713)

pull/724/head
Jakob Ankarhem 4 years ago committed by GitHub
parent 2d31ea940a
commit 660ada0b20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,
});

Loading…
Cancel
Save