mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-06 01:15:28 +02:00
fix: correctly query roles to be removed (#5275)
Fixes / refactors the way roles are being fetched in `removeRolesOfTypeForUser` to be more consistent with the rest of our code base.
This commit is contained in:
parent
75d91360b3
commit
1539cb7553
@ -770,9 +770,10 @@ export class AccessStore implements IAccessStore {
|
|||||||
userId: number,
|
userId: number,
|
||||||
roleTypes: string[],
|
roleTypes: string[],
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const rolesToRemove = this.db(T.ROLES)
|
const rolesToRemove = await this.db(T.ROLES)
|
||||||
.select('id')
|
.select('id')
|
||||||
.whereIn('type', roleTypes);
|
.whereIn('type', roleTypes)
|
||||||
|
.pluck('id');
|
||||||
|
|
||||||
return this.db(T.ROLE_USER)
|
return this.db(T.ROLE_USER)
|
||||||
.where({ user_id: userId })
|
.where({ user_id: userId })
|
||||||
|
Loading…
Reference in New Issue
Block a user