Merge pull request #3368 from nichwall/fix_tag_permissions

Fix tag permissions
This commit is contained in:
advplyr 2024-09-02 15:58:05 -05:00 committed by GitHub
commit f194c5be0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -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]) {

View File

@ -108,6 +108,7 @@ class User extends Model {
accessAllLibraries: true,
accessAllTags: true,
accessExplicitContent: true,
selectedTagsNotAccessible: false,
librariesAccessible: [],
itemTagsSelected: []
}