mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: show profile projects correctly (#3422)
Profile projects were not showing correctly in most cases. This fixes the query to only take into consider whether you have access to the project (either directly or through a group). ![image](https://user-images.githubusercontent.com/14320932/228598175-874f0daa-8d33-49a8-b6f8-072942876138.png)
This commit is contained in:
parent
f60f0a7b31
commit
fbb1280b0e
@ -391,14 +391,12 @@ class ProjectStore implements IProjectStore {
|
||||
}
|
||||
|
||||
async getProjectsByUser(userId: number): Promise<string[]> {
|
||||
const members = await this.db
|
||||
const projects = await this.db
|
||||
.from((db) => {
|
||||
db.select('project')
|
||||
.from('role_user')
|
||||
.leftJoin('roles', 'role_user.role_id', 'roles.id')
|
||||
.where('type', 'root')
|
||||
.andWhere('name', 'Editor')
|
||||
.andWhere('user_id', userId)
|
||||
.where('user_id', userId)
|
||||
.union((queryBuilder) => {
|
||||
queryBuilder
|
||||
.select('project')
|
||||
@ -413,7 +411,7 @@ class ProjectStore implements IProjectStore {
|
||||
.as('query');
|
||||
})
|
||||
.pluck('project');
|
||||
return members;
|
||||
return projects;
|
||||
}
|
||||
|
||||
async getMembersCountByProject(projectId: string): Promise<number> {
|
||||
|
Loading…
Reference in New Issue
Block a user