fix document 500 error and fix users tabel for bot

This commit is contained in:
lendry
2026-06-26 10:32:04 +03:00
parent ead3155ad8
commit d5e6b58955
17 changed files with 396 additions and 67 deletions

View File

@@ -13,6 +13,11 @@ interface RequesterProfile {
async function getRequesterProfile(jwt: JwtService, core: CoreGrpcService, authorization?: string): Promise<RequesterProfile> {
const payload = await verifyAccessToken(jwt, authorization);
await assertSessionUnlocked(core, payload);
if (payload.isSuperAdmin) {
return { id: payload.sub, isSuperAdmin: true, canViewUserDocuments: true };
}
const profile = (await firstValueFrom(core.auth.GetMe({ userId: payload.sub }))) as RequesterProfile & { id: string };
return { id: profile.id, isSuperAdmin: profile.isSuperAdmin, canViewUserDocuments: profile.canViewUserDocuments };
}