From 09d0d47549cfa148c50e514214df1f1f32659649 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 29 Apr 2022 16:50:06 -0500 Subject: [PATCH] Fix:Setting user can access all libraries/tags --- server/objects/user/User.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/server/objects/user/User.js b/server/objects/user/User.js index 16afe944..fd405e48 100644 --- a/server/objects/user/User.js +++ b/server/objects/user/User.js @@ -189,6 +189,7 @@ class User { } } }) + // And update permissions if (payload.permissions) { for (const key in payload.permissions) { @@ -198,8 +199,15 @@ class User { } } } + // Update accessible libraries - if (payload.librariesAccessible !== undefined) { + if (this.permissions.accessAllLibraries) { + // Access all libraries + if (this.librariesAccessible.length) { + this.librariesAccessible = [] + hasUpdates = true + } + } else if (payload.librariesAccessible !== undefined) { if (payload.librariesAccessible.length) { if (payload.librariesAccessible.join(',') !== this.librariesAccessible.join(',')) { hasUpdates = true @@ -211,8 +219,14 @@ class User { } } - // Update accessible libraries - if (payload.itemTagsAccessible !== undefined) { + // Update accessible tags + if (this.permissions.accessAllTags) { + // Access all tags + if (this.itemTagsAccessible.length) { + this.itemTagsAccessible = [] + hasUpdates = true + } + } else if (payload.itemTagsAccessible !== undefined) { if (payload.itemTagsAccessible.length) { if (payload.itemTagsAccessible.join(',') !== this.itemTagsAccessible.join(',')) { hasUpdates = true