@open-rlb/ng-app 3.1.17 → 3.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,20 +15,20 @@ import { RLB_TRANSLATION_SERVICE, RlbBootstrapModule, ModalDirective, ToastDirec
|
|
|
15
15
|
import * as i1$5 from 'angular-auth-oidc-client';
|
|
16
16
|
import { AbstractLoggerService, AuthModule, provideAuth, AuthInterceptor, AbstractSecurityStorage } from 'angular-auth-oidc-client';
|
|
17
17
|
import * as i1 from 'ngx-cookie-service-ssr';
|
|
18
|
-
import { filter, switchMap, map, BehaviorSubject, of, share, lastValueFrom, from, zip, EMPTY, catchError, Observable, tap, shareReplay, distinctUntilChanged, take
|
|
18
|
+
import { filter, switchMap, map, BehaviorSubject, of, share, lastValueFrom, from, zip, EMPTY, catchError, Observable, tap, shareReplay, distinctUntilChanged, take } from 'rxjs';
|
|
19
19
|
import { signalStore, withState, withMethods, patchState } from '@ngrx/signals';
|
|
20
20
|
import { tapResponse } from '@ngrx/operators';
|
|
21
21
|
import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
|
|
22
22
|
import * as i1$3 from '@ngx-translate/core';
|
|
23
23
|
import { TranslateModule } from '@ngx-translate/core';
|
|
24
24
|
import { provideTranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
25
|
-
import { take, map as map$1, switchMap as switchMap$1, tap as tap$1 } from 'rxjs/operators';
|
|
26
25
|
import * as i1$6 from '@angular/common';
|
|
27
26
|
import { isPlatformServer, CommonModule } from '@angular/common';
|
|
28
27
|
import * as i3 from '@angular/forms';
|
|
29
28
|
import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
30
29
|
import * as i1$7 from '@angular/cdk/layout';
|
|
31
30
|
import { Breakpoints } from '@angular/cdk/layout';
|
|
31
|
+
import { tap as tap$1, map as map$1, switchMap as switchMap$1 } from 'rxjs/operators';
|
|
32
32
|
|
|
33
33
|
// export const RLB_CFG = 'rlb.options';
|
|
34
34
|
const RLB_CFG = new InjectionToken('rlb.options');
|
|
@@ -1632,23 +1632,18 @@ class CompanyInterceptor {
|
|
|
1632
1632
|
if (!isAllowed || !authConfig?.enableCompanyInterceptor) {
|
|
1633
1633
|
return next.handle(req);
|
|
1634
1634
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1635
|
+
const currentApp = this.store.selectSignal(state => state[appContextFeatureKey].currentApp)();
|
|
1636
|
+
const data = currentApp?.data;
|
|
1637
|
+
const mapping = this.config.acl?.interceptorMapping || {};
|
|
1638
|
+
const map = Object.keys(mapping).forEach((key) => {
|
|
1639
|
+
const storeKey = mapping[key];
|
|
1640
|
+
const value = data?.[storeKey];
|
|
1641
|
+
if (!!value) {
|
|
1642
|
+
req.params.set(key, value);
|
|
1640
1643
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
Object.entries(mapping).forEach(([httpParamName, storeDataKey]) => {
|
|
1645
|
-
const value = app.data[storeDataKey];
|
|
1646
|
-
if (value !== undefined && value !== null) {
|
|
1647
|
-
params = params.set(httpParamName, value.toString());
|
|
1648
|
-
}
|
|
1649
|
-
});
|
|
1650
|
-
return req.clone({ params });
|
|
1651
|
-
}), switchMap$1(clonedReq => next.handle(clonedReq)));
|
|
1644
|
+
});
|
|
1645
|
+
const clonedReq = req.clone({ params: req.params });
|
|
1646
|
+
return next.handle(clonedReq);
|
|
1652
1647
|
}
|
|
1653
1648
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: CompanyInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1654
1649
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: CompanyInterceptor }); }
|
|
@@ -2553,7 +2548,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImpor
|
|
|
2553
2548
|
|
|
2554
2549
|
const oauthGuard = (route, state) => {
|
|
2555
2550
|
const authService = inject(AuthenticationService);
|
|
2556
|
-
return authService.isAuthenticated$.pipe(take
|
|
2551
|
+
return authService.isAuthenticated$.pipe(take(1), map((isAuthenticated) => {
|
|
2557
2552
|
if (!isAuthenticated) {
|
|
2558
2553
|
authService.login(state.url);
|
|
2559
2554
|
return false;
|
|
@@ -2568,7 +2563,7 @@ const permissionGuard = (route) => {
|
|
|
2568
2563
|
const resource = route.data['resource'];
|
|
2569
2564
|
const action = route.data['action'];
|
|
2570
2565
|
// toObservable helps wait for 'loaded' to be true
|
|
2571
|
-
return toObservable(store.loaded).pipe(filter(Boolean), take
|
|
2566
|
+
return toObservable(store.loaded).pipe(filter(Boolean), take(1), map(() => store.hasPermission(resource, action)
|
|
2572
2567
|
? true
|
|
2573
2568
|
: router.createUrlTree(['/notFound'])));
|
|
2574
2569
|
};
|