ghostfolio/apps/api/src/services/impersonation.service.ts

17 lines
459 B
TypeScript
Raw Normal View History

2021-04-13 21:53:58 +02:00
import { Injectable } from '@nestjs/common';
import { PrismaService } from './prisma.service';
@Injectable()
export class ImpersonationService {
2021-08-07 22:38:07 +02:00
public constructor(private readonly prismaService: PrismaService) {}
2021-04-13 21:53:58 +02:00
public async validateImpersonationId(aId = '', aUserId: string) {
2021-08-07 22:38:07 +02:00
const accessObject = await this.prismaService.access.findFirst({
2021-04-13 21:53:58 +02:00
where: { GranteeUser: { id: aUserId }, id: aId }
});
return accessObject?.userId;
}
}