mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +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). 
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