RED-8164: fixed UsersAdmin stuck in infinite loop.
This commit is contained in:
parent
333700073b
commit
7d72d6c755
@ -13,6 +13,7 @@ import { NGXLogger } from 'ngx-logger';
|
|||||||
import { firstValueFrom } from 'rxjs';
|
import { firstValueFrom } from 'rxjs';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
import { APP_BASE_HREF } from '@angular/common';
|
import { APP_BASE_HREF } from '@angular/common';
|
||||||
|
import { getCurrentUser } from '@users/user.service';
|
||||||
|
|
||||||
async function redirectToLastDossierTemplate(router: Router, state: RouterStateSnapshot, baseHref: string, lastDossierTemplate: string) {
|
async function redirectToLastDossierTemplate(router: Router, state: RouterStateSnapshot, baseHref: string, lastDossierTemplate: string) {
|
||||||
const lastUrlSegment = window.location.pathname.split('/').filter(Boolean).pop();
|
const lastUrlSegment = window.location.pathname.split('/').filter(Boolean).pop();
|
||||||
@ -43,6 +44,8 @@ export function mainGuard(): AsyncGuard {
|
|||||||
|
|
||||||
const generalConfig$ = inject(GeneralSettingsService).getGeneralConfigurations();
|
const generalConfig$ = inject(GeneralSettingsService).getGeneralConfigurations();
|
||||||
const updatedDisplayName$ = generalConfig$.pipe(tap(config => configService.updateDisplayName(config.displayName)));
|
const updatedDisplayName$ = generalConfig$.pipe(tap(config => configService.updateDisplayName(config.displayName)));
|
||||||
|
const currentUser = getCurrentUser();
|
||||||
|
const isUsersAdminOnly = currentUser.isUserAdmin && currentUser.roles.length === 1;
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
systemPreferencesService.loadPreferencesIfNeeded(),
|
systemPreferencesService.loadPreferencesIfNeeded(),
|
||||||
@ -52,7 +55,7 @@ export function mainGuard(): AsyncGuard {
|
|||||||
|
|
||||||
const lastDossierTemplate = userPreferenceService.getLastDossierTemplate();
|
const lastDossierTemplate = userPreferenceService.getLastDossierTemplate();
|
||||||
|
|
||||||
if (lastDossierTemplate) {
|
if (lastDossierTemplate && !isUsersAdminOnly) {
|
||||||
await redirectToLastDossierTemplate(router, state, baseHref, lastDossierTemplate);
|
await redirectToLastDossierTemplate(router, state, baseHref, lastDossierTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit da086cdaa648d1d35a9eb16ee23cb223e1de2316
|
Subproject commit bd77067dc7a10bad1b21a3e0807f4ea6413da4ad
|
||||||
Loading…
x
Reference in New Issue
Block a user