@acorex/modules 20.6.0-next.6 → 20.6.0-next.7

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.
@@ -1,5 +1,5 @@
1
1
  import { AXMDeviceSessionsService, AXMDeviceSessionsServiceImpl } from '@acorex/modules/auth';
2
- import { createAllQueryView, AXPEntityCommandScope, AXPEntityQueryType, AXPSearchCommandProvider, AXPRefreshEvent, AXP_MENU_PROVIDER, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
2
+ import { createAllQueryView, AXPEntityCommandScope, AXPEntityQueryType, AXPSearchCommandProvider, AXPRefreshEvent, AXP_ROOT_CONFIG_TOKEN, AXP_MENU_PROVIDER, AXP_SEARCH_PROVIDER } from '@acorex/platform/common';
3
3
  import * as i2 from '@acorex/platform/layout/widget-core';
4
4
  import { AXPWidgetsCatalog, AXPWidgetGroupEnum, AXPWidgetCoreModule, AXPValueWidgetComponent, AXPColumnWidgetComponent, AXPLayoutBaseWidgetComponent } from '@acorex/platform/layout/widget-core';
5
5
  import { entityMasterCrudActions, AXMEntityCrudServiceImpl, entityMasterRecordActions, AXPEntityService, AXPEntityResolver, AXPEntityDefinitionRegistryService, AXP_ENTITY_DEFINITION_LOADER } from '@acorex/platform/layout/entity';
@@ -12,6 +12,8 @@ import { AXDialogService } from '@acorex/components/dialog';
12
12
  import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
13
13
  import * as i2$2 from '@acorex/core/translation';
14
14
  import { AXTranslationService, AXTranslationModule } from '@acorex/core/translation';
15
+ import { HttpClient, HttpHeaders } from '@angular/common/http';
16
+ import { firstValueFrom } from 'rxjs';
15
17
  import { AXPDataGenerator, AXP_DATASOURCE_DEFINITION_PROVIDER, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER } from '@acorex/platform/core';
16
18
  import { AXP_USER_AVATAR_PROVIDER, AXPThemeLayoutBlockComponent, AXPStateMessageComponent } from '@acorex/platform/layout/components';
17
19
  import { AXP_NAME_PROPERTY, AXP_DATA_PATH_PROPERTY, AXP_DISABLED_PROPERTY } from '@acorex/platform/layout/widgets';
@@ -2167,8 +2169,44 @@ const AXPSessionTerminateWorkflow = {
2167
2169
  class AXMUserAvatarProvider {
2168
2170
  constructor() {
2169
2171
  this.userService = inject(AXMUsersEntityService);
2172
+ this.sessionService = inject(AXPSessionService);
2173
+ this.http = inject(HttpClient);
2174
+ this.configs = inject(AXP_ROOT_CONFIG_TOKEN);
2175
+ this.baseUrl = this.configs.baseUrl;
2170
2176
  }
2171
2177
  async provide(userId) {
2178
+ // Check if requesting current user info
2179
+ const currentUser = this.sessionService.user;
2180
+ const isCurrentUser = currentUser?.id === userId;
2181
+ if (isCurrentUser) {
2182
+ // Use OpenIddict /connect/userinfo endpoint for current user
2183
+ try {
2184
+ // Extract base URL without /api suffix and add /connect/userinfo
2185
+ const authority = this.baseUrl.replace(/\/api$/, '');
2186
+ const userInfoUrl = `${authority}/connect/userinfo`;
2187
+ const token = this.sessionService.getToken();
2188
+ // Add Authorization header if token exists (interceptor will also add it, but explicit is better)
2189
+ const headers = new HttpHeaders();
2190
+ if (token) {
2191
+ headers.set('Authorization', `Bearer ${token}`);
2192
+ }
2193
+ const userInfo = await firstValueFrom(this.http.get(userInfoUrl, { headers }));
2194
+ const [firstName, lastName] = (userInfo.name || userInfo.sub || '').split(' ') || ['', ''];
2195
+ return {
2196
+ id: userInfo.sub || userId,
2197
+ username: userInfo.preferred_username || userInfo.name || '',
2198
+ firstName: firstName || userInfo.given_name || '',
2199
+ lastName: lastName || userInfo.family_name || '',
2200
+ status: 'online',
2201
+ avatarUrl: userInfo.picture || 'https://via.placeholder.com/150',
2202
+ };
2203
+ }
2204
+ catch (error) {
2205
+ console.error('Failed to load userinfo from /connect/userinfo, falling back to entity service', error);
2206
+ // Fallback to entity service if userinfo endpoint fails
2207
+ }
2208
+ }
2209
+ // Use entity service for other users or as fallback
2172
2210
  const user = await this.userService.getOne(userId);
2173
2211
  if (!user) {
2174
2212
  throw new Error(`User not found for ${userId}`);
@@ -2478,7 +2516,7 @@ class AXMSecurityManagementModule {
2478
2516
  multi: true,
2479
2517
  useFactory: async () => {
2480
2518
  const injector = inject(Injector);
2481
- const provider = (await import('./acorex-modules-security-management-permission-definition.provider-BI-BShPG.mjs')).AXMPermissionDefinitionProvider;
2519
+ const provider = (await import('./acorex-modules-security-management-permission-definition.provider-DPI8gT7K.mjs')).AXMPermissionDefinitionProvider;
2482
2520
  return new provider(injector);
2483
2521
  },
2484
2522
  },
@@ -2556,7 +2594,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
2556
2594
  multi: true,
2557
2595
  useFactory: async () => {
2558
2596
  const injector = inject(Injector);
2559
- const provider = (await import('./acorex-modules-security-management-permission-definition.provider-BI-BShPG.mjs')).AXMPermissionDefinitionProvider;
2597
+ const provider = (await import('./acorex-modules-security-management-permission-definition.provider-DPI8gT7K.mjs')).AXMPermissionDefinitionProvider;
2560
2598
  return new provider(injector);
2561
2599
  },
2562
2600
  },
@@ -3096,4 +3134,4 @@ var permissionsWidgetDesigner_component = /*#__PURE__*/Object.freeze({
3096
3134
  */
3097
3135
 
3098
3136
  export { AXMPermissionsKeys as A, RootConfig as R, AXMSecurityManagementDeviceSessionsEntityModule as a, AXMSecurityManagementRolesEntityService as b, AXMSecurityManagementRolesEntityServiceImpl as c, AXMUsersEntityService as d, AXMUsersEntityServiceImpl as e, factory$3 as f, AXMPolicyService as g, AXMPolicyServiceImpl as h, AXPSecurityManagementMenuKeys as i, AXMSecurityManagementModule as j, AXPPermissionsEditorComponent as k, AXPPermissionsEditorPopupComponent as l, AXMPermissionsModule as m, AXPPermissionsWidgetViewComponent as n, AXPPermissionsWidgetEditComponent as o, policyFactory as p, AXPPermissionsWidgetColumnComponent as q, AXPPermissionsWidgetPrintComponent as r, AXPPermissionsWidgetDesignerComponent as s, AXPPermissionsWidget as t };
3099
- //# sourceMappingURL=acorex-modules-security-management-acorex-modules-security-management-DDwXZErT.mjs.map
3137
+ //# sourceMappingURL=acorex-modules-security-management-acorex-modules-security-management-B6bWjwlY.mjs.map