@acorex/platform 20.6.0-next.8 → 21.0.0-next.0
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.
- package/auth/index.d.ts +91 -12
- package/common/index.d.ts +615 -44
- package/core/index.d.ts +718 -422
- package/fesm2022/acorex-platform-auth.mjs +152 -39
- package/fesm2022/acorex-platform-auth.mjs.map +1 -1
- package/fesm2022/acorex-platform-common.mjs +1009 -112
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-core.mjs +887 -408
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-domain.mjs +99 -11
- package/fesm2022/acorex-platform-domain.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +555 -492
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-components.mjs +2446 -2733
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-designer.mjs +9 -9
- package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +9708 -4721
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-views.mjs +32 -26
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs +252 -182
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/fesm2022/{acorex-platform-layout-widgets-file-list-popup.component-D0y-9nE5.mjs → acorex-platform-layout-widgets-file-list-popup.component-CxrsI6Hn.mjs} +2 -2
- package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-CxrsI6Hn.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-V31OpYah.mjs +30 -0
- package/fesm2022/acorex-platform-layout-widgets-image-preview.popup-V31OpYah.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-tabular-data-edit-popup.component-C1l2KSDa.mjs → acorex-platform-layout-widgets-tabular-data-edit-popup.component-Ck7-wpT2.mjs} +2 -2
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-Ck7-wpT2.mjs.map +1 -0
- package/fesm2022/{acorex-platform-layout-widgets-tabular-data-view-popup.component-D-31ej0C.mjs → acorex-platform-layout-widgets-tabular-data-view-popup.component-y8vjUiVs.mjs} +2 -2
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-y8vjUiVs.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-widgets.mjs +9789 -6817
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/fesm2022/acorex-platform-runtime.mjs +79 -3
- package/fesm2022/acorex-platform-runtime.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-VIGuU5M4.mjs +157 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-VIGuU5M4.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs +1542 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DyDa_hyd.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Ua3ZA5hk.mjs +101 -0
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-Ua3ZA5hk.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-B_P0a5KW.mjs → acorex-platform-themes-default-entity-master-single-view.component-eMBby9k4.mjs} +3 -3
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-eMBby9k4.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +282 -43
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-C0EpfU2k.mjs +55 -0
- package/fesm2022/acorex-platform-themes-shared-icon-chooser-column.component-C0EpfU2k.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-shared.mjs +42 -137
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/fesm2022/acorex-platform-workflow.mjs +658 -45
- package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
- package/layout/builder/index.d.ts +10 -34
- package/layout/components/index.d.ts +694 -375
- package/layout/designer/index.d.ts +4 -4
- package/layout/entity/index.d.ts +802 -183
- package/layout/views/index.d.ts +5 -58
- package/layout/widget-core/index.d.ts +63 -75
- package/layout/widgets/README.md +0 -1
- package/layout/widgets/index.d.ts +498 -129
- package/package.json +5 -5
- package/runtime/index.d.ts +36 -8
- package/themes/default/index.d.ts +44 -75
- package/themes/shared/index.d.ts +11 -49
- package/workflow/index.d.ts +401 -90
- package/fesm2022/acorex-platform-layout-entity-create-entity.command-DGeylNSY.mjs +0 -52
- package/fesm2022/acorex-platform-layout-entity-create-entity.command-DGeylNSY.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-edit.component-fhhZOWul.mjs +0 -50
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-edit.component-fhhZOWul.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-view.component-C3Qbs0fz.mjs +0 -42
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-schema-widget-view.component-C3Qbs0fz.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-edit.component-CngQBUlN.mjs +0 -55
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-edit.component-CngQBUlN.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-view.component-DSNo9e4W.mjs +0 -50
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-values-widget-view.component-DSNo9e4W.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-edit.component-CL0CwEHX.mjs +0 -48
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-edit.component-CL0CwEHX.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-view.component-B6Fi0xTw.mjs +0 -42
- package/fesm2022/acorex-platform-layout-widgets-extra-properties-widget-view.component-B6Fi0xTw.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-file-list-popup.component-D0y-9nE5.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-edit-popup.component-C1l2KSDa.mjs.map +0 -1
- package/fesm2022/acorex-platform-layout-widgets-tabular-data-view-popup.component-D-31ej0C.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-WbPPqDON.mjs +0 -115
- package/fesm2022/acorex-platform-themes-default-entity-master-create-view.component-WbPPqDON.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CD7rJIMh.mjs +0 -803
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CD7rJIMh.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BTA6h7Xd.mjs +0 -101
- package/fesm2022/acorex-platform-themes-default-entity-master-modify-view.component-BTA6h7Xd.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-B_P0a5KW.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, Injector, Injectable, signal, inject, Input, Directive, provideAppInitializer, Optional, Inject, NgModule } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
import { AXPBroadcastEventService } from '@acorex/platform/core';
|
|
3
|
+
import { AXPBroadcastEventService, AXP_MODULE_PROVIDER_LOADER, AXPModuleProviderRegistry, AXP_SESSION_SERVICE } from '@acorex/platform/core';
|
|
5
4
|
import { isEmpty } from 'lodash-es';
|
|
5
|
+
import { map, BehaviorSubject, shareReplay, defaultIfEmpty, switchMap, filter, from, first } from 'rxjs';
|
|
6
6
|
|
|
7
7
|
const AXP_APPLICATION_LOADER = new InjectionToken('AXP_APPLICATION_LOADER', {
|
|
8
8
|
providedIn: 'root',
|
|
@@ -11,25 +11,29 @@ const AXP_APPLICATION_LOADER = new InjectionToken('AXP_APPLICATION_LOADER', {
|
|
|
11
11
|
},
|
|
12
12
|
});
|
|
13
13
|
class AXPApplicationDefaultLoader {
|
|
14
|
-
getList(context) {
|
|
15
|
-
return
|
|
14
|
+
async getList(context) {
|
|
15
|
+
return [
|
|
16
16
|
{
|
|
17
17
|
id: '1',
|
|
18
18
|
name: 'default-app',
|
|
19
19
|
title: 'Default Application',
|
|
20
20
|
version: '1.0.0',
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
edition: {
|
|
22
|
+
id: 'default-edition-1',
|
|
23
|
+
title: 'Standard',
|
|
24
|
+
},
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
27
|
id: '2',
|
|
26
28
|
name: 'default-app',
|
|
27
29
|
title: 'Default Application',
|
|
28
30
|
version: '1.0.0',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
edition: {
|
|
32
|
+
id: 'default-edition-2',
|
|
33
|
+
title: 'Standard',
|
|
34
|
+
},
|
|
31
35
|
},
|
|
32
|
-
]
|
|
36
|
+
];
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
|
|
@@ -40,14 +44,14 @@ const AXP_TENANT_LOADER = new InjectionToken('AXP_TENANT_LOADER', {
|
|
|
40
44
|
},
|
|
41
45
|
});
|
|
42
46
|
class AXPTenantDefaultLoader {
|
|
43
|
-
getList(context) {
|
|
44
|
-
return
|
|
47
|
+
async getList(context) {
|
|
48
|
+
return [
|
|
45
49
|
{
|
|
46
50
|
id: '1',
|
|
47
51
|
name: 'default-tenant',
|
|
48
52
|
title: 'Default Tenant',
|
|
49
53
|
},
|
|
50
|
-
]
|
|
54
|
+
];
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
|
|
@@ -85,8 +89,8 @@ const AXP_FEATURE_LOADER = new InjectionToken('AXP_FEATURE_LOADER', {
|
|
|
85
89
|
},
|
|
86
90
|
});
|
|
87
91
|
class AXPFeatureDefaultLoader {
|
|
88
|
-
getList(context) {
|
|
89
|
-
return
|
|
92
|
+
async getList(context) {
|
|
93
|
+
return [];
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
|
|
@@ -173,6 +177,13 @@ const AXPFeatureGuard = (route, state) => {
|
|
|
173
177
|
}));
|
|
174
178
|
};
|
|
175
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Optional injection token for feature checker.
|
|
182
|
+
* If provided, the checker will be called to potentially override
|
|
183
|
+
* feature enablement results based on custom logic.
|
|
184
|
+
*/
|
|
185
|
+
const AXP_FEATURE_CHECKER = new InjectionToken('AXP_FEATURE_CHECKER');
|
|
186
|
+
|
|
176
187
|
const AXP_PERMISSION_LOADER = new InjectionToken('AXP_PERMISSION_LOADER', {
|
|
177
188
|
providedIn: 'root',
|
|
178
189
|
factory: () => {
|
|
@@ -180,11 +191,18 @@ const AXP_PERMISSION_LOADER = new InjectionToken('AXP_PERMISSION_LOADER', {
|
|
|
180
191
|
}
|
|
181
192
|
});
|
|
182
193
|
class AXPPermissionDefaultLoader {
|
|
183
|
-
getList(context) {
|
|
184
|
-
return
|
|
194
|
+
async getList(context) {
|
|
195
|
+
return [];
|
|
185
196
|
}
|
|
186
197
|
}
|
|
187
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Optional injection token for permission checker.
|
|
201
|
+
* If provided, the checker will be called to potentially override
|
|
202
|
+
* authorization results based on custom logic.
|
|
203
|
+
*/
|
|
204
|
+
const AXP_PERMISSION_CHECKER = new InjectionToken('AXP_PERMISSION_CHECKER');
|
|
205
|
+
|
|
188
206
|
class AXPSessionContext {
|
|
189
207
|
get user() {
|
|
190
208
|
return this._user;
|
|
@@ -222,6 +240,9 @@ class AXPSessionService {
|
|
|
222
240
|
this.featureLoader = inject(AXP_FEATURE_LOADER);
|
|
223
241
|
this.tenantLoader = inject(AXP_TENANT_LOADER);
|
|
224
242
|
this.applicationLoader = inject(AXP_APPLICATION_LOADER);
|
|
243
|
+
this.moduleProviderLoader = inject(AXP_MODULE_PROVIDER_LOADER);
|
|
244
|
+
this.permissionChecker = inject(AXP_PERMISSION_CHECKER, { optional: true });
|
|
245
|
+
this.featureChecker = inject(AXP_FEATURE_CHECKER, { optional: true });
|
|
225
246
|
this.status = new BehaviorSubject(AXPSessionStatus.Unauthenticated);
|
|
226
247
|
this.status$ = this.status.asObservable().pipe(shareReplay(1));
|
|
227
248
|
// Add loading state to prevent premature redirects
|
|
@@ -244,8 +265,10 @@ class AXPSessionService {
|
|
|
244
265
|
// Add a new observable that considers loading state
|
|
245
266
|
this.isAuthenticatedWithLoading$ = this.isLoading$.pipe(switchMap((loading) => {
|
|
246
267
|
if (loading) {
|
|
268
|
+
// Wait for loading to complete, then return authentication status
|
|
247
269
|
return this.isLoading$.pipe(filter((isLoading) => !isLoading), switchMap(() => this.isAuthenticated$));
|
|
248
270
|
}
|
|
271
|
+
// If not loading, return current authentication status
|
|
249
272
|
return this.isAuthenticated$;
|
|
250
273
|
}), shareReplay(1));
|
|
251
274
|
this.isAuthorized$ = this.status$.pipe(map((status) => status === AXPSessionStatus.Authorized), shareReplay(1));
|
|
@@ -266,7 +289,7 @@ class AXPSessionService {
|
|
|
266
289
|
return this.currentTenantSubject.value;
|
|
267
290
|
}
|
|
268
291
|
get tenants$() {
|
|
269
|
-
return this.tenantLoader.getList(this.getContext());
|
|
292
|
+
return from(this.tenantLoader.getList(this.getContext()));
|
|
270
293
|
}
|
|
271
294
|
get application() {
|
|
272
295
|
const session = this.getSessionData();
|
|
@@ -276,7 +299,7 @@ class AXPSessionService {
|
|
|
276
299
|
return this.currentApplicationSubject.value;
|
|
277
300
|
}
|
|
278
301
|
get applications$() {
|
|
279
|
-
return this.applicationLoader.getList(this.getContext());
|
|
302
|
+
return from(this.applicationLoader.getList(this.getContext()));
|
|
280
303
|
}
|
|
281
304
|
get permissions() {
|
|
282
305
|
return this.permissionsSubject.value ?? [];
|
|
@@ -291,7 +314,18 @@ class AXPSessionService {
|
|
|
291
314
|
if (sessionData) {
|
|
292
315
|
if (sessionData.user) {
|
|
293
316
|
this.currentUserSubject.next(sessionData.user);
|
|
317
|
+
// Restore tenant and application from session data
|
|
318
|
+
if (sessionData.tenant) {
|
|
319
|
+
this.currentTenantSubject.next(sessionData.tenant);
|
|
320
|
+
}
|
|
321
|
+
if (sessionData.application) {
|
|
322
|
+
this.currentApplicationSubject.next(sessionData.application);
|
|
323
|
+
}
|
|
294
324
|
this.status.next(AXPSessionStatus.Authenticated);
|
|
325
|
+
// Load required modules first to ensure entities are available for loaders
|
|
326
|
+
// This is critical because loaders (like application.loader) need entities
|
|
327
|
+
// from required modules (ApplicationManagement, TenantManagement, SecurityManagement)
|
|
328
|
+
await this.moduleProviderLoader.loadRequiredModules();
|
|
295
329
|
await this.loadPermissions();
|
|
296
330
|
await this.loadFeatures();
|
|
297
331
|
await this.signInComplete();
|
|
@@ -409,6 +443,9 @@ class AXPSessionService {
|
|
|
409
443
|
}
|
|
410
444
|
//
|
|
411
445
|
const userId = this.user?.id;
|
|
446
|
+
// Clear module provider loader cache before clearing session
|
|
447
|
+
// This ensures modules and providers from previous user are not cached
|
|
448
|
+
await this.moduleProviderLoader.clear();
|
|
412
449
|
this.clearSession();
|
|
413
450
|
this.eventService.publish(AXPSessionStatus.SignedOut, { id: userId });
|
|
414
451
|
this.isLoading.next(false);
|
|
@@ -457,7 +494,7 @@ class AXPSessionService {
|
|
|
457
494
|
}
|
|
458
495
|
async loadPermissions() {
|
|
459
496
|
try {
|
|
460
|
-
const permissions = await
|
|
497
|
+
const permissions = await this.permissionLoader.getList(this.getContext());
|
|
461
498
|
this.permissionsSubject.next(permissions ?? []);
|
|
462
499
|
}
|
|
463
500
|
catch (error) {
|
|
@@ -467,7 +504,7 @@ class AXPSessionService {
|
|
|
467
504
|
}
|
|
468
505
|
async loadFeatures() {
|
|
469
506
|
try {
|
|
470
|
-
const features = await
|
|
507
|
+
const features = await this.featureLoader.getList(this.getContext());
|
|
471
508
|
this.featuresSubject.next(features ?? []);
|
|
472
509
|
}
|
|
473
510
|
catch (error) {
|
|
@@ -547,26 +584,39 @@ class AXPSessionService {
|
|
|
547
584
|
localStorage.removeItem(AXPSessionService.SESSION_KEY);
|
|
548
585
|
}
|
|
549
586
|
authorize(...keys) {
|
|
550
|
-
|
|
587
|
+
// Calculate base result
|
|
588
|
+
const baseResult = keys.every((k) => {
|
|
589
|
+
if (isEmpty(k))
|
|
590
|
+
return true;
|
|
591
|
+
// Check if user has the permission
|
|
592
|
+
const hasPermission = this.permissions.indexOf(k) > -1;
|
|
593
|
+
if (!hasPermission)
|
|
594
|
+
return false;
|
|
595
|
+
// Check if permission has required features (if permission definition service is available)
|
|
596
|
+
// Note: This is a lightweight check. Full feature validation happens in permission definition service.
|
|
597
|
+
return true;
|
|
598
|
+
});
|
|
599
|
+
// If permission checker is provided, use it to potentially override the result
|
|
600
|
+
if (this.permissionChecker) {
|
|
601
|
+
const context = this.getContext();
|
|
602
|
+
return this.permissionChecker.check(keys, context, baseResult);
|
|
603
|
+
}
|
|
604
|
+
return baseResult;
|
|
551
605
|
}
|
|
552
606
|
isFeatureEnabled(...keys) {
|
|
553
|
-
|
|
607
|
+
// Calculate base result
|
|
608
|
+
const baseResult = keys.every((k) => isEmpty(k) || this.features.some((c) => c.name == k && c.value == true));
|
|
609
|
+
// If feature checker is provided, use it to potentially override the result
|
|
610
|
+
if (this.featureChecker) {
|
|
611
|
+
const context = this.getContext();
|
|
612
|
+
return this.featureChecker.check(keys, context, baseResult);
|
|
613
|
+
}
|
|
614
|
+
return baseResult;
|
|
554
615
|
}
|
|
555
616
|
getToken() {
|
|
556
617
|
const sessionData = this.getSessionData();
|
|
557
618
|
return sessionData?.accessToken;
|
|
558
619
|
}
|
|
559
|
-
checkTokenValidation() {
|
|
560
|
-
let sessionData = this.getSessionData();
|
|
561
|
-
if (sessionData && sessionData?.accessToken && sessionData.expiresIn) {
|
|
562
|
-
const expiresInDate = new Date(sessionData.expiresIn);
|
|
563
|
-
if (expiresInDate > new Date()) {
|
|
564
|
-
// Token is still valid
|
|
565
|
-
return true;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
return false;
|
|
569
|
-
}
|
|
570
620
|
getContext() {
|
|
571
621
|
return new AXPSessionContext({
|
|
572
622
|
user: this.user,
|
|
@@ -687,12 +737,13 @@ class AXPPermissionDefinitionGroupBuilder {
|
|
|
687
737
|
this.context = context;
|
|
688
738
|
this._group = group;
|
|
689
739
|
}
|
|
690
|
-
addPermission(name, title, description) {
|
|
740
|
+
addPermission(name, title, description, requiredFeatures) {
|
|
691
741
|
const permission = {
|
|
692
742
|
name,
|
|
693
743
|
title,
|
|
694
744
|
description,
|
|
695
|
-
children: []
|
|
745
|
+
children: [],
|
|
746
|
+
requiredFeatures
|
|
696
747
|
};
|
|
697
748
|
this._group.permissions.push(permission);
|
|
698
749
|
return new AXPPermissionDefinitionBuilder(this, permission);
|
|
@@ -712,16 +763,25 @@ class AXPPermissionDefinitionBuilder {
|
|
|
712
763
|
this.groupBuilder = groupBuilder;
|
|
713
764
|
this.permission = permission;
|
|
714
765
|
}
|
|
715
|
-
addChild(name, title, description) {
|
|
766
|
+
addChild(name, title, description, requiredFeatures) {
|
|
716
767
|
const permission = {
|
|
717
768
|
name,
|
|
718
769
|
title,
|
|
719
770
|
description,
|
|
720
|
-
children: []
|
|
771
|
+
children: [],
|
|
772
|
+
requiredFeatures
|
|
721
773
|
};
|
|
722
774
|
this.permission.children.push(permission);
|
|
723
775
|
return this;
|
|
724
776
|
}
|
|
777
|
+
/**
|
|
778
|
+
* Set required features for this permission.
|
|
779
|
+
* @param features - Array of feature names (e.g., ['PlatformManagement.menu-customization'])
|
|
780
|
+
*/
|
|
781
|
+
requireFeatures(...features) {
|
|
782
|
+
this.permission.requiredFeatures = features;
|
|
783
|
+
return this;
|
|
784
|
+
}
|
|
725
785
|
endPermission() {
|
|
726
786
|
return this.groupBuilder;
|
|
727
787
|
}
|
|
@@ -736,6 +796,8 @@ const AXP_PERMISSION_DEFINITION_PROVIDER = new InjectionToken('AXP_PERMISSION_DE
|
|
|
736
796
|
class AXPPermissionDefinitionService {
|
|
737
797
|
constructor() {
|
|
738
798
|
this.providers = inject(AXP_PERMISSION_DEFINITION_PROVIDER, { optional: true });
|
|
799
|
+
this.providerRegistry = inject(AXPModuleProviderRegistry);
|
|
800
|
+
this.sessionService = inject(AXPSessionService);
|
|
739
801
|
this.cache = null;
|
|
740
802
|
}
|
|
741
803
|
async load() {
|
|
@@ -743,6 +805,7 @@ class AXPPermissionDefinitionService {
|
|
|
743
805
|
return;
|
|
744
806
|
}
|
|
745
807
|
const context = new AXPPermissionDefinitionProviderContext();
|
|
808
|
+
// Load providers from DI tokens (backward compatibility)
|
|
746
809
|
if (Array.isArray(this.providers)) {
|
|
747
810
|
for (const provider of this.providers) {
|
|
748
811
|
if (provider instanceof Promise) {
|
|
@@ -756,7 +819,49 @@ class AXPPermissionDefinitionService {
|
|
|
756
819
|
}
|
|
757
820
|
}
|
|
758
821
|
}
|
|
759
|
-
|
|
822
|
+
// Load providers from registry (manifest-based, conditionally loaded)
|
|
823
|
+
const registryProviders = this.providerRegistry.getPermissionProviders();
|
|
824
|
+
for (const provider of registryProviders) {
|
|
825
|
+
await provider.define(context);
|
|
826
|
+
}
|
|
827
|
+
// Filter permissions based on required features
|
|
828
|
+
const allGroups = context.getGroupDefinitions();
|
|
829
|
+
this.cache = this.filterByFeatures(allGroups);
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Filter permissions based on required features.
|
|
833
|
+
* Removes permissions that have required features that are not enabled.
|
|
834
|
+
*/
|
|
835
|
+
filterByFeatures(groups) {
|
|
836
|
+
return groups.map(group => ({
|
|
837
|
+
...group,
|
|
838
|
+
permissions: this.filterPermissions(group.permissions)
|
|
839
|
+
})).filter(group => group.permissions.length > 0);
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Recursively filter permissions and their children based on required features.
|
|
843
|
+
*/
|
|
844
|
+
filterPermissions(permissions) {
|
|
845
|
+
return permissions
|
|
846
|
+
.filter(permission => {
|
|
847
|
+
// Check if required features are enabled
|
|
848
|
+
if (permission.requiredFeatures && permission.requiredFeatures.length > 0) {
|
|
849
|
+
const allFeaturesEnabled = permission.requiredFeatures.every(featureName => this.sessionService.isFeatureEnabled(featureName));
|
|
850
|
+
if (!allFeaturesEnabled) {
|
|
851
|
+
return false; // Filter out this permission
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return true;
|
|
855
|
+
})
|
|
856
|
+
.map(permission => ({
|
|
857
|
+
...permission,
|
|
858
|
+
children: this.filterPermissions(permission.children)
|
|
859
|
+
}))
|
|
860
|
+
.filter(permission => {
|
|
861
|
+
// Remove permissions that have no children if they were only containers
|
|
862
|
+
// (This is optional - you might want to keep parent permissions even without children)
|
|
863
|
+
return true;
|
|
864
|
+
});
|
|
760
865
|
}
|
|
761
866
|
async reload() {
|
|
762
867
|
this.cache = null;
|
|
@@ -882,6 +987,10 @@ class AXPAuthModule {
|
|
|
882
987
|
const initializerFn = initializeAppState(inject(AXPSessionService));
|
|
883
988
|
return initializerFn();
|
|
884
989
|
}),
|
|
990
|
+
{
|
|
991
|
+
provide: AXP_SESSION_SERVICE,
|
|
992
|
+
useExisting: AXPSessionService,
|
|
993
|
+
},
|
|
885
994
|
] }); }
|
|
886
995
|
}
|
|
887
996
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXPAuthModule, decorators: [{
|
|
@@ -895,6 +1004,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
895
1004
|
const initializerFn = initializeAppState(inject(AXPSessionService));
|
|
896
1005
|
return initializerFn();
|
|
897
1006
|
}),
|
|
1007
|
+
{
|
|
1008
|
+
provide: AXP_SESSION_SERVICE,
|
|
1009
|
+
useExisting: AXPSessionService,
|
|
1010
|
+
},
|
|
898
1011
|
],
|
|
899
1012
|
}]
|
|
900
1013
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
@@ -988,5 +1101,5 @@ class TimeUtil {
|
|
|
988
1101
|
* Generated bundle index. Do not edit.
|
|
989
1102
|
*/
|
|
990
1103
|
|
|
991
|
-
export { AXPAuthGuard, AXPAuthModule, AXPAuthStrategy, AXPAuthStrategyRegistryService, AXPFeatureDirective, AXPFeatureGuard, AXPPermissionDefinitionBuilder, AXPPermissionDefinitionGroupBuilder, AXPPermissionDefinitionProviderContext, AXPPermissionDefinitionService, AXPPermissionDirective, AXPPermissionEvaluatorScopeProvider, AXPPermissionGuard, AXPSessionContext, AXPSessionService, AXPSessionStatus, AXPUnauthenticatedError, AXPUnauthorizedError, AXP_APPLICATION_LOADER, AXP_FEATURE_LOADER, AXP_PERMISSION_DEFINITION_PROVIDER, AXP_PERMISSION_LOADER, AXP_TENANT_LOADER, JwtUtil, PkceUtil, TimeUtil, initializeAppState };
|
|
1104
|
+
export { AXPAuthGuard, AXPAuthModule, AXPAuthStrategy, AXPAuthStrategyRegistryService, AXPFeatureDirective, AXPFeatureGuard, AXPPermissionDefinitionBuilder, AXPPermissionDefinitionGroupBuilder, AXPPermissionDefinitionProviderContext, AXPPermissionDefinitionService, AXPPermissionDirective, AXPPermissionEvaluatorScopeProvider, AXPPermissionGuard, AXPSessionContext, AXPSessionService, AXPSessionStatus, AXPUnauthenticatedError, AXPUnauthorizedError, AXP_APPLICATION_LOADER, AXP_FEATURE_CHECKER, AXP_FEATURE_LOADER, AXP_PERMISSION_CHECKER, AXP_PERMISSION_DEFINITION_PROVIDER, AXP_PERMISSION_LOADER, AXP_TENANT_LOADER, JwtUtil, PkceUtil, TimeUtil, initializeAppState };
|
|
992
1105
|
//# sourceMappingURL=acorex-platform-auth.mjs.map
|