1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-27 13:49:10 +02:00

fix: private projects visibility for users in editor and admin groups (#10265)

https://linear.app/unleash/issue/2-3665/viewer-role-in-admin-group-cannot-access-private-projects

Fixes a bug where private projects were not visible for viewers that
belonged to Editor or Admin groups.
This commit is contained in:
Nuno Góis 2025-07-01 17:16:52 +01:00 committed by GitHub
parent a748502f7d
commit a251a9808a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,6 +39,20 @@ class PrivateProjectStore implements IPrivateProjectStore {
'roles.name': 'Viewer',
'roles.type': 'root',
})
.whereNotExists((builder) => {
builder
.select('*')
.from('group_user')
.join('groups', 'group_user.group_id', 'groups.id')
.join(
'roles as group_roles',
'groups.root_role_id',
'group_roles.id',
)
.whereRaw('group_user.user_id = role_user.user_id')
.whereIn('group_roles.name', ['Admin', 'Editor'])
.andWhere('group_roles.type', 'root');
})
.count('*')
.then((res) => Number(res[0].count));