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