mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-24 01:18:01 +02: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[]> {
|
async getProjectsByUser(userId: number): Promise<string[]> {
|
||||||
const members = await this.db
|
const projects = await this.db
|
||||||
.from((db) => {
|
.from((db) => {
|
||||||
db.select('project')
|
db.select('project')
|
||||||
.from('role_user')
|
.from('role_user')
|
||||||
.leftJoin('roles', 'role_user.role_id', 'roles.id')
|
.leftJoin('roles', 'role_user.role_id', 'roles.id')
|
||||||
.where('type', 'root')
|
.where('user_id', userId)
|
||||||
.andWhere('name', 'Editor')
|
|
||||||
.andWhere('user_id', userId)
|
|
||||||
.union((queryBuilder) => {
|
.union((queryBuilder) => {
|
||||||
queryBuilder
|
queryBuilder
|
||||||
.select('project')
|
.select('project')
|
||||||
@ -413,7 +411,7 @@ class ProjectStore implements IProjectStore {
|
|||||||
.as('query');
|
.as('query');
|
||||||
})
|
})
|
||||||
.pluck('project');
|
.pluck('project');
|
||||||
return members;
|
return projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMembersCountByProject(projectId: string): Promise<number> {
|
async getMembersCountByProject(projectId: string): Promise<number> {
|
||||||
|
Loading…
Reference in New Issue
Block a user