mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
add project in the token
This commit is contained in:
@ -5,4 +5,5 @@ export class AuthInterface {
|
||||
sessionId: string;
|
||||
id: number;
|
||||
role?: object;
|
||||
project?: object;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ export class AuthService {
|
||||
email,
|
||||
region: regionUuid ? { uuid: regionUuid } : undefined,
|
||||
},
|
||||
relations: ['roleType'],
|
||||
relations: ['roleType', 'project'],
|
||||
});
|
||||
if (
|
||||
platform === PlatformType.WEB &&
|
||||
@ -105,6 +105,7 @@ export class AuthService {
|
||||
googleCode: user.googleCode,
|
||||
hasAcceptedWebAgreement: user.hasAcceptedWebAgreement,
|
||||
hasAcceptedAppAgreement: user.hasAcceptedAppAgreement,
|
||||
project: user?.project,
|
||||
};
|
||||
if (payload.googleCode) {
|
||||
const profile = await this.getProfile(payload.googleCode);
|
||||
|
@ -32,6 +32,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
|
||||
uuid: payload.uuid,
|
||||
sessionId: payload.sessionId,
|
||||
role: payload?.role,
|
||||
project: payload?.project,
|
||||
};
|
||||
} else {
|
||||
throw new BadRequestException('Unauthorized');
|
||||
|
@ -35,6 +35,7 @@ export class RefreshTokenStrategy extends PassportStrategy(
|
||||
uuid: payload.uuid,
|
||||
sessionId: payload.sessionId,
|
||||
role: payload?.role,
|
||||
project: payload?.project,
|
||||
};
|
||||
} else {
|
||||
throw new BadRequestException('Unauthorized');
|
||||
|
Reference in New Issue
Block a user