Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
fix(backend:users): include current user in whitelist
johaven38aac5d61f98
diff --git a/backend/src/applications/users/services/users-queries.service.ts b/backend/src/applications/users/services/users-queries.service.tsindex 9b6ca191..26858454 100644--- a/backend/src/applications/users/services/users-queries.service.ts+++ b/backend/src/applications/users/services/users-queries.service.ts@@ -510,6 +510,7 @@ export class UsersQueries {@CacheDecorator(1800)async usersWhitelist(userId: number, lowerOrEqualUserRole: USER_ROLE = USER_ROLE.GUEST): Promise<number[]> {/* Get the list of user ids allowed to the current user+ - the current user, when their role is lower than or equal to lowerOrEqualUserRole- users with no groups only when applications.users.showUngroupedUsers = true(guest accounts are excluded from this global branch, and guest requesters never get this branch)(also excludes users with a role higher than lowerOrEqualUserRole)@@ -542,6 +543,14 @@ export class UsersQueries {)SELECT JSON_ARRAYAGG(id) AS idsFROM (+ -- 0) Current user+ SELECT ${users.id} AS id+ FROM ${users}+ WHERE ${users.id} = ${userId}+ AND ${users.role} <= ${lowerOrEqualUserRole}++ UNION+-- 1) Users from groups visible to the current userSELECT ${users.id} AS idFROM ${users}