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:
parent
a748502f7d
commit
a251a9808a
@ -39,6 +39,20 @@ class PrivateProjectStore implements IPrivateProjectStore {
|
|||||||
'roles.name': 'Viewer',
|
'roles.name': 'Viewer',
|
||||||
'roles.type': 'root',
|
'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('*')
|
.count('*')
|
||||||
.then((res) => Number(res[0].count));
|
.then((res) => Number(res[0].count));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user