Skip to content

Commit

Permalink
Merge pull request #3368 from nichwall/fix_tag_permissions
Browse files Browse the repository at this point in the history
Fix tag permissions
  • Loading branch information
advplyr authored Sep 2, 2024
2 parents 48f2327 + 47712e6 commit f194c5b
Show file tree
Hide file tree
Showing 2 changed files with 4 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.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
1 change: 1 addition & 0 deletions server/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class User extends Model {
accessAllLibraries: true,
accessAllTags: true,
accessExplicitContent: true,
selectedTagsNotAccessible: false,
librariesAccessible: [],
itemTagsSelected: []
}
Expand Down

0 comments on commit f194c5b

Please sign in to comment.