fix(auth): transition users only when transition mode enabled

This commit is contained in:
Karol Sójko 2023-09-08 13:34:54 +02:00
parent 398338c8f8
commit 610fba2601
No known key found for this signature in database
GPG key ID: C2F813669419D05F
2 changed files with 9 additions and 5 deletions

View file

@ -981,6 +981,7 @@ export class ContainerConfigLoader {
container.get(TYPES.Auth_GenerateRecoveryCodes),
container.get(TYPES.Auth_Logger),
container.get(TYPES.Auth_SessionService),
container.get(TYPES.Auth_TRANSITION_MODE_ENABLED),
),
)
container

View file

@ -37,6 +37,7 @@ export class AuthController implements UserServerInterface {
private doGenerateRecoveryCodes: GenerateRecoveryCodes,
private logger: Logger,
private sessionService: SessionServiceInterface,
private transitionModeEnabled: boolean,
) {}
async update(_params: UserUpdateRequestParams): Promise<HttpResponse<UserUpdateResponse>> {
@ -227,11 +228,13 @@ export class AuthController implements UserServerInterface {
if (userUuid !== null) {
headers = new Map([['x-invalidate-cache', userUuid]])
await this.domainEventPublisher.publish(
this.domainEventFactory.createTransitionRequestedEvent({
userUuid,
}),
)
if (this.transitionModeEnabled) {
await this.domainEventPublisher.publish(
this.domainEventFactory.createTransitionRequestedEvent({
userUuid,
}),
)
}
}
return {