Skip to content

Commit

Permalink
Allow update of default permission keys missing for user
Browse files Browse the repository at this point in the history
  • Loading branch information
nichwall committed Sep 2, 2024
1 parent 9cca731 commit 790c1fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/controllers/UserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,10 @@ class UserController {
const permissions = {
...user.permissions
}
const defaultPermissions = Database.userModel.getDefaultPermissionsForUserType(updatePayload.type || 'user')
for (const key in updatePayload.permissions) {
if (permissions[key] !== undefined) {
// Check that the key is a valid permission key or is included in the default permissions
if (permissions[key] !== undefined || defaultPermissions[key] !== undefined) {
if (typeof updatePayload.permissions[key] !== 'boolean') {
Logger.warn(`[UserController] update: Invalid permission value for key ${key}. Should be boolean`)
} else if (permissions[key] !== updatePayload.permissions[key]) {
Expand Down

0 comments on commit 790c1fb

Please sign in to comment.