@open-rlb/ng-app 3.1.10 → 3.1.11
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.
|
@@ -9,7 +9,7 @@ import { provideServiceWorker } from '@angular/service-worker';
|
|
|
9
9
|
import * as i1$8 from '@ngrx/effects';
|
|
10
10
|
import { createEffect, ofType, provideEffects } from '@ngrx/effects';
|
|
11
11
|
import * as i1$1 from '@ngrx/store';
|
|
12
|
-
import { createActionGroup, props, emptyProps, createFeature, createReducer, on, provideStore, provideState } from '@ngrx/store';
|
|
12
|
+
import { createActionGroup, props, emptyProps, Store, createFeature, createReducer, on, provideStore, provideState } from '@ngrx/store';
|
|
13
13
|
import * as i2$1 from '@open-rlb/ng-bootstrap';
|
|
14
14
|
import { RLB_TRANSLATION_SERVICE, RlbBootstrapModule, ModalDirective, ToastDirective, ModalRegistryOptions, ToastRegistryOptions, provideRlbBootstrap } from '@open-rlb/ng-bootstrap';
|
|
15
15
|
import * as i1$5 from 'angular-auth-oidc-client';
|
|
@@ -2493,6 +2493,35 @@ const oauthGuard = (route, state) => {
|
|
|
2493
2493
|
}));
|
|
2494
2494
|
};
|
|
2495
2495
|
|
|
2496
|
+
const permissionGuard = (route) => {
|
|
2497
|
+
console.log("permission guard", route);
|
|
2498
|
+
const store = inject(Store);
|
|
2499
|
+
const router = inject(Router);
|
|
2500
|
+
// Get requirements from route data
|
|
2501
|
+
const requiredResource = route.data['resource'];
|
|
2502
|
+
const requiredAction = route.data['action'];
|
|
2503
|
+
return store.select(state => state[aclFeatureKey]).pipe(
|
|
2504
|
+
// Wait until the Initializer/Effect has actually finished loading the data
|
|
2505
|
+
filter((acl) => acl.loaded), take(1), map((acl) => {
|
|
2506
|
+
console.log("permission guard map", JSON.stringify(acl));
|
|
2507
|
+
if (!acl.resources)
|
|
2508
|
+
return router.createUrlTree(['/not-found']);
|
|
2509
|
+
const hasPermission = acl.resources.some(product => product.resources.some(res => {
|
|
2510
|
+
const matchName = res.resourceId === requiredResource || res.resourceName === requiredResource;
|
|
2511
|
+
if (!requiredAction) {
|
|
2512
|
+
return matchName;
|
|
2513
|
+
}
|
|
2514
|
+
return matchName && res.actions.includes(requiredAction);
|
|
2515
|
+
}));
|
|
2516
|
+
if (hasPermission) {
|
|
2517
|
+
return true;
|
|
2518
|
+
}
|
|
2519
|
+
// Redirect on failure
|
|
2520
|
+
console.warn(`Access denied for resource: ${requiredResource}`);
|
|
2521
|
+
return router.createUrlTree(['/notFound']);
|
|
2522
|
+
}));
|
|
2523
|
+
};
|
|
2524
|
+
|
|
2496
2525
|
const SESSION_RT = 'RT';
|
|
2497
2526
|
const SESSION_AT = 'AT';
|
|
2498
2527
|
const TOKEN_URL = `protocol/openid-connect/token`;
|
|
@@ -3255,5 +3284,5 @@ function flattenRoutes(routes, parentPath = '') {
|
|
|
3255
3284
|
* Generated bundle index. Do not edit.
|
|
3256
3285
|
*/
|
|
3257
3286
|
|
|
3258
|
-
export { AbstractMdService, AbstractSupportService, AclActions, AppBreadcrumbService, AppContainerComponent, AppContextActions, AppContextActionsInternal, AppLoggerService, AppStorageService, AppTemplateComponent, AppsService, AsMultiPipe, AsSinglePipe, AuthActions, AuthActionsInternal, AuthFeatureService, AuthenticationService, AutolinkPipe, BaseComponent, CmsComponent, CmsPipe, ContentComponent, CookiesService, ErrorManagementService, ErrorModalComponent, KeycloakProfileService, LanguageService, LeftComponentPipe, LocalCacheService, ModalAppsComponent, NavbarActions, NavbarActionsInternal, OauthPasswordService, ParseJwtService, PwaUpdaterService, RLB_APPS, RLB_APP_NAVCOMP, RLB_CFG, RLB_CFG_ACL, RLB_CFG_AUTH, RLB_CFG_CMS, RLB_CFG_ENV, RLB_CFG_I18N, RLB_CFG_PAGES, RightComponentPipe, RlbAppModule, RlbRole, SidebarActions, SidebarActionsInternal, StrapiService, ToastComponent, TokenOauthInterceptor, TranslateBrowserLoader, TruncatePipe, UtilsService, aclFeatureKey, appContextFeatureKey, authsFeatureKey, getDefaultRoutes, initialAclState, initialAppContextState, initialAuthState, initialNavbarState, initialSidebarState, navbarsFeatureKey, oauthGuard, oauthPasswordGuard, provideApp, provideRlbCodeBrowserOAuth, provideRlbConfig, provideRlbI18n, sidebarsFeatureKey, translateBrowserLoaderFactory, verifyDeactivate };
|
|
3287
|
+
export { AbstractMdService, AbstractSupportService, AclActions, AppBreadcrumbService, AppContainerComponent, AppContextActions, AppContextActionsInternal, AppLoggerService, AppStorageService, AppTemplateComponent, AppsService, AsMultiPipe, AsSinglePipe, AuthActions, AuthActionsInternal, AuthFeatureService, AuthenticationService, AutolinkPipe, BaseComponent, CmsComponent, CmsPipe, ContentComponent, CookiesService, ErrorManagementService, ErrorModalComponent, KeycloakProfileService, LanguageService, LeftComponentPipe, LocalCacheService, ModalAppsComponent, NavbarActions, NavbarActionsInternal, OauthPasswordService, ParseJwtService, PwaUpdaterService, RLB_APPS, RLB_APP_NAVCOMP, RLB_CFG, RLB_CFG_ACL, RLB_CFG_AUTH, RLB_CFG_CMS, RLB_CFG_ENV, RLB_CFG_I18N, RLB_CFG_PAGES, RightComponentPipe, RlbAppModule, RlbRole, SidebarActions, SidebarActionsInternal, StrapiService, ToastComponent, TokenOauthInterceptor, TranslateBrowserLoader, TruncatePipe, UtilsService, aclFeatureKey, appContextFeatureKey, authsFeatureKey, getDefaultRoutes, initialAclState, initialAppContextState, initialAuthState, initialNavbarState, initialSidebarState, navbarsFeatureKey, oauthGuard, oauthPasswordGuard, permissionGuard, provideApp, provideRlbCodeBrowserOAuth, provideRlbConfig, provideRlbI18n, sidebarsFeatureKey, translateBrowserLoaderFactory, verifyDeactivate };
|
|
3259
3288
|
//# sourceMappingURL=open-rlb-ng-app.mjs.map
|