@acorex-platform/module-security-management-client 0.0.58 → 0.0.60

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.
Files changed (61) hide show
  1. package/fesm2022/{acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-BSGZRsGz.mjs → acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-B61j_cJF.mjs} +212 -13
  2. package/fesm2022/acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-B61j_cJF.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-security-management-client-approve-join-request.command-BSvK59LV.mjs +322 -0
  4. package/fesm2022/acorex-platform-module-security-management-client-approve-join-request.command-BSvK59LV.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-device-sessions.mjs +21 -2
  6. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-device-sessions.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-users.mjs +173 -14
  8. package/fesm2022/acorex-platform-module-security-management-client-contracts-entities-users.mjs.map +1 -1
  9. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-B4oiF8FO.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-JP3zTrun.mjs} +10 -10
  10. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-B4oiF8FO.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-acorex-platform-module-security-management-client-contracts-entity-catalog-JP3zTrun.mjs.map} +1 -1
  11. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-CU-5X-qu.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-lwQtCJoy.mjs} +23 -4
  12. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-lwQtCJoy.mjs.map +1 -0
  13. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-Bld1buTd.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-DZfizo-n.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-Bld1buTd.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-identity-provider.entity-DZfizo-n.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-DZVzHzVM.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-Dkl_6Iio.mjs} +2 -2
  16. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-DZVzHzVM.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-policy.entity-Dkl_6Iio.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-BCy5fNc9.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-Ddbd-rAG.mjs} +2 -2
  18. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-BCy5fNc9.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-profile.entity-Ddbd-rAG.mjs.map} +1 -1
  19. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-DcvYjfZm.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-WCgik8MV.mjs} +2 -2
  20. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-DcvYjfZm.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-role-permission.entity-WCgik8MV.mjs.map} +1 -1
  21. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-lNKDIDry.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-CRZftClq.mjs} +2 -2
  22. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-lNKDIDry.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-roles.entity-CRZftClq.mjs.map} +1 -1
  23. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-DKII6o5N.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-9QpoRCOF.mjs} +2 -2
  24. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-DKII6o5N.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-user-role.entity-9QpoRCOF.mjs.map} +1 -1
  25. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-ge21b3mE.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-C34VzcYk.mjs} +2 -2
  26. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-ge21b3mE.mjs.map → acorex-platform-module-security-management-client-contracts-entity-catalog-user-two-factor.entity-C34VzcYk.mjs.map} +1 -1
  27. package/fesm2022/{acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-CJ7x5rjC.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-DuC5cfIb.mjs} +175 -16
  28. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-DuC5cfIb.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog.mjs +1 -1
  30. package/fesm2022/acorex-platform-module-security-management-client-contracts.mjs +342 -4
  31. package/fesm2022/acorex-platform-module-security-management-client-contracts.mjs.map +1 -1
  32. package/fesm2022/acorex-platform-module-security-management-client-create-user-in-tenant.command-BFnZRmh9.mjs +376 -0
  33. package/fesm2022/acorex-platform-module-security-management-client-create-user-in-tenant.command-BFnZRmh9.mjs.map +1 -0
  34. package/fesm2022/{acorex-platform-module-security-management-client-index-DKk9lEIl.mjs → acorex-platform-module-security-management-client-index-B6qo6qLT.mjs} +5 -156
  35. package/fesm2022/acorex-platform-module-security-management-client-index-B6qo6qLT.mjs.map +1 -0
  36. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-ClQ6WxxN.mjs +370 -0
  37. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-ClQ6WxxN.mjs.map +1 -0
  38. package/fesm2022/acorex-platform-module-security-management-client-reject-join-request.command-B3kiok6b.mjs +76 -0
  39. package/fesm2022/acorex-platform-module-security-management-client-reject-join-request.command-B3kiok6b.mjs.map +1 -0
  40. package/fesm2022/{acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs → acorex-platform-module-security-management-client-reset-two-factor.command-C27mUZ1-.mjs} +7 -2
  41. package/fesm2022/acorex-platform-module-security-management-client-reset-two-factor.command-C27mUZ1-.mjs.map +1 -0
  42. package/fesm2022/{acorex-platform-module-security-management-client-send-password-reset-email.command-CoQgWdya.mjs → acorex-platform-module-security-management-client-send-password-reset-email.command-DFxm2T_x.mjs} +7 -2
  43. package/fesm2022/acorex-platform-module-security-management-client-send-password-reset-email.command-DFxm2T_x.mjs.map +1 -0
  44. package/fesm2022/acorex-platform-module-security-management-client-settings.provider-CwDiU-C8.mjs +54 -0
  45. package/fesm2022/acorex-platform-module-security-management-client-settings.provider-CwDiU-C8.mjs.map +1 -0
  46. package/fesm2022/acorex-platform-module-security-management-client-user-role-grant.service-6U17jzjq.mjs +231 -0
  47. package/fesm2022/acorex-platform-module-security-management-client-user-role-grant.service-6U17jzjq.mjs.map +1 -0
  48. package/fesm2022/acorex-platform-module-security-management-client.mjs +1 -1
  49. package/i18n/en-AU/security-management.json +91 -4
  50. package/i18n/en-US/security-management.json +91 -4
  51. package/i18n/fa-IR/security-management.json +91 -4
  52. package/package.json +1 -1
  53. package/types/acorex-platform-module-security-management-client-contracts.d.ts +288 -8
  54. package/fesm2022/acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-BSGZRsGz.mjs.map +0 -1
  55. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-CU-5X-qu.mjs.map +0 -1
  56. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-CJ7x5rjC.mjs.map +0 -1
  57. package/fesm2022/acorex-platform-module-security-management-client-index-DKk9lEIl.mjs.map +0 -1
  58. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs +0 -143
  59. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs.map +0 -1
  60. package/fesm2022/acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs.map +0 -1
  61. package/fesm2022/acorex-platform-module-security-management-client-send-password-reset-email.command-CoQgWdya.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-platform-module-security-management-client-index-DKk9lEIl.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/features/user-roles/user-role-grant.service.ts","../../../../libs/modules/security-management/client/src/lib/features/user-roles/pages/user-roles-page/user-roles-page.component.ts","../../../../libs/modules/security-management/client/src/lib/features/user-roles/pages/user-roles-page/user-roles-page.component.html","../../../../libs/modules/security-management/client/src/lib/features/user-roles/pages/user-roles-page/user-roles-page-component.provider.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport { AXPEntityBroadcastService } from '@acorex-platform/framework-client/core';\nimport {\n AXPEntityDefinitionRegistryService,\n AXPEntityService,\n dispatchEntityModifiedSideEffects,\n} from '@acorex-platform/framework-client/layout/entity';\nimport { RootConfig } from '@acorex-platform/module-security-management-client/contracts';\nimport { Injectable, inject } from '@angular/core';\nimport type {\n SaveUserRoleGrantOptions,\n UserRoleGrantRow,\n UserRoleOption,\n} from './user-role-grant.types';\n\n//#endregion\n\n//#region ----- Service -----\n\n/**\n * Loads and persists scoped UserRole assignments for a user.\n * Shared by the User roles detail page.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXMUserRoleGrantService {\n //#region ----- Services & Dependencies -----\n\n private readonly entityRegistry = inject(AXPEntityDefinitionRegistryService);\n private readonly entityService = inject(AXPEntityService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly entityEvents = inject(AXPEntityBroadcastService);\n\n //#endregion\n\n //#region ----- Scope -----\n\n resolveSessionScope(): { tenantId: string; applicationId: string | undefined } | null {\n const tenantId = this.sessionService.tenant?.id;\n if (!tenantId) {\n return null;\n }\n return {\n tenantId,\n applicationId: this.sessionService.application?.id,\n };\n }\n\n //#endregion\n\n //#region ----- Query -----\n\n private userRoleData() {\n return this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.userRole.name)\n .data<string, UserRoleGrantRow, UserRoleGrantRow>();\n }\n\n /**\n * Roles available to assign in the current workspace.\n * Also loads any already-assigned role ids that list queries hide (`stateInfo.isHidden`).\n */\n async listRoleOptions(includeRoleIds: readonly string[] = []): Promise<UserRoleOption[]> {\n const roleData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.roles.name)\n .data<string, UserRoleOption, UserRoleOption>();\n\n const result = await roleData.query({\n skip: 0,\n take: 500,\n } as never);\n\n const byId = new Map<string, UserRoleOption>();\n const items = (result?.items ?? []) as unknown as Array<Record<string, unknown>>;\n for (const item of items) {\n const id = String(item['id'] ?? '');\n if (!id) {\n continue;\n }\n byId.set(id, {\n id,\n title: String(item['title'] ?? item['name'] ?? ''),\n name: typeof item['name'] === 'string' ? item['name'] : undefined,\n });\n }\n\n const missingIds = includeRoleIds.filter((id) => id && !byId.has(id));\n await Promise.all(\n missingIds.map(async (id) => {\n try {\n const row = (await roleData.byKey(id)) as Record<string, unknown> | null;\n if (!row?.['id']) {\n return;\n }\n byId.set(String(row['id']), {\n id: String(row['id']),\n title: String(row['title'] ?? row['name'] ?? row['id']),\n name: typeof row['name'] === 'string' ? row['name'] : undefined,\n });\n } catch {\n /* role missing or inaccessible */\n }\n }),\n );\n\n return [...byId.values()].sort((a, b) => a.title.localeCompare(b.title));\n }\n\n async findGrant(\n userId: string,\n tenantId: string,\n applicationId: string | undefined,\n ): Promise<UserRoleGrantRow | null> {\n const result = await this.userRoleData().query({\n skip: 0,\n take: 50,\n filter: {\n logic: 'and',\n filters: [\n { field: 'userId', operator: { type: 'equal' }, value: userId },\n { field: 'scopeInfo.tenantId', operator: { type: 'equal' }, value: tenantId },\n ],\n },\n } as never);\n\n const items = (result?.items ?? []) as UserRoleGrantRow[];\n if (items.length === 0) {\n return null;\n }\n\n if (applicationId) {\n const appMatch = items.find((item) => item.scopeInfo?.applicationId === applicationId);\n if (appMatch) {\n return appMatch;\n }\n }\n\n const tenantWide = items.find((item) => !item.scopeInfo?.applicationId);\n return tenantWide ?? items[0] ?? null;\n }\n\n //#endregion\n\n //#region ----- Persist -----\n\n async saveGrant(options: SaveUserRoleGrantOptions): Promise<Record<string, unknown>> {\n const existingState = options.existing?.stateInfo;\n if (existingState?.isSystem === true || existingState?.isImmutable === true) {\n throw new Error('System user role grants are readonly.');\n }\n\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.userRole.name}`;\n const [moduleName, entityName] = entityKey.split('.');\n const entityRef = await this.entityRegistry.resolve(moduleName, entityName);\n\n const scopeInfo = {\n tenantId: options.tenantId,\n ...(options.existing?.scopeInfo?.applicationId\n ? { applicationId: options.existing.scopeInfo.applicationId }\n : options.applicationId\n ? { applicationId: options.applicationId }\n : {}),\n };\n\n if (options.existing?.id) {\n const updatePayload = {\n ...options.existing,\n userId: options.userId,\n roleIds: options.roleIds,\n scopeInfo,\n };\n return (\n entityRef.commands?.update?.execute as (data: Record<string, unknown>) => Promise<Record<string, unknown>>\n )(updatePayload);\n }\n\n const createPayload = {\n userId: options.userId,\n roleIds: options.roleIds,\n scopeInfo,\n };\n return (\n entityRef.commands?.create?.execute as (data: Record<string, unknown>) => Promise<Record<string, unknown>>\n )(createPayload);\n }\n\n notifyGrantModified(saved: Record<string, unknown>): void {\n const entityKey = `${RootConfig.module.name}.${RootConfig.entities.userRole.name}`;\n dispatchEntityModifiedSideEffects(this.entityEvents, entityKey, saved);\n }\n\n //#endregion\n}\n\n//#endregion\n","//#region ----- Imports -----\n\nimport {\n AXPActionMenuItem,\n AXPExecuteCommand,\n type AXPRuntimeCommandResult,\n} from '@acorex-platform/framework-shared/core';\nimport type { AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport type { AXPLayoutDetailsViewAction } from '@acorex-platform/framework-client/layout/views';\nimport { AXPPageLayoutBase, AXPPageLayoutBaseComponent } from '@acorex-platform/framework-client/layout/views';\nimport { AXPStateMessageComponent } from '@acorex-platform/framework-client/layout/components';\nimport { AXValueChangedEvent } from '@acorex/cdk/common';\nimport { AXSelectionListModule } from '@acorex/components/selection-list';\nimport { AXSkeletonModule } from '@acorex/components/skeleton';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { AsyncPipe } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { isEqual } from 'lodash-es';\nimport { resolvePersistedEntityId } from '../../../permissions/resolve-persisted-entity-id.util';\nimport { AXMUserRoleGrantService } from '../../user-role-grant.service';\nimport type { UserRoleGrantRow, UserRoleOption } from '../../user-role-grant.types';\n\n//#endregion\n\n//#region ----- Constants -----\n\nconst USER_ROLES_DISCARD_COMMAND = 'User:Roles:Discard';\nconst USER_ROLES_SAVE_COMMAND = 'User:Roles:Save';\n\n//#endregion\n\n//#region ----- Component -----\n\n/**\n * User detail/create wizard page that edits scoped UserRole assignments.\n */\n@Component({\n selector: 'axm-user-roles-page',\n standalone: true,\n imports: [\n AXPStateMessageComponent,\n AXSelectionListModule,\n AXSkeletonModule,\n AXTranslationModule,\n AsyncPipe,\n FormsModule,\n ],\n templateUrl: './user-roles-page.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: AXPPageLayoutBase,\n useExisting: AXMUserRolesPageComponent,\n },\n ],\n host: {\n class: 'flex h-full min-h-0 flex-1 flex-col overflow-hidden',\n },\n})\nexport class AXMUserRolesPageComponent extends AXPPageLayoutBaseComponent {\n //#region ----- Inputs -----\n\n rootContext = input<Record<string, unknown>>();\n pageConfig = input<Record<string, unknown>>();\n\n //#endregion\n\n //#region ----- Services & Dependencies -----\n\n private readonly grantService = inject(AXMUserRoleGrantService);\n private readonly hostPageLayout = inject(AXPPageLayoutBase, { optional: true, skipSelf: true });\n\n //#endregion\n\n //#region ----- State Signals -----\n\n private readonly loadedUserId = signal<string | undefined>(undefined);\n private readonly existingGrant = signal<UserRoleGrantRow | null>(null);\n private readonly baselineRoleIds = signal<string[]>([]);\n protected readonly currentRoleIds = signal<string[]>([]);\n protected readonly roleOptions = signal<UserRoleOption[]>([]);\n protected readonly isLoading = signal(true);\n\n //#endregion\n\n //#region ----- Computed Properties -----\n\n protected readonly userId = computed(() => resolvePersistedEntityId(this.rootContext()));\n\n protected readonly isDirty = computed(() => {\n return !this.areRoleSetsEqual(this.baselineRoleIds(), this.currentRoleIds());\n });\n\n /** System UserRole grants are seeded and not editable in product/platform UI. */\n protected readonly isGrantReadonly = computed(() => {\n const state = this.existingGrant()?.stateInfo;\n return state?.isSystem === true || state?.isImmutable === true;\n });\n\n /** Checkbox + label row placeholders for the loading skeleton */\n protected readonly roleSkeletonPlaceholders = computed(() => [\n 'w-40',\n 'w-28',\n 'w-48',\n 'w-32',\n 'w-44',\n 'w-36',\n 'w-40',\n 'w-52',\n ]);\n\n //#endregion\n\n //#region ----- Lifecycle -----\n\n constructor() {\n super();\n effect(() => {\n const id = this.userId();\n untracked(() => {\n void this.loadGrantForUser(id);\n });\n });\n }\n\n //#endregion\n\n //#region ----- Unsaved Changes -----\n\n override hasUnsavedChanges(): boolean {\n return this.isDirty();\n }\n\n //#endregion\n\n //#region ----- Page Actions -----\n\n override async getPrimaryMenuItems(): Promise<AXPActionMenuItem[]> {\n const discardTitle = (await this.translateService.translateAsync('@general:actions.discard.title')) ?? '';\n const saveTitle = (await this.translateService.translateAsync('@general:actions.save.title')) ?? '';\n const canEdit = !!this.userId() && !this.isLoading() && !this.isGrantReadonly();\n\n const discardAction: AXPLayoutDetailsViewAction = {\n title: discardTitle,\n icon: 'fa-light fa-rotate-left',\n zone: 'footer',\n priority: 'secondary',\n color: 'default',\n visible: canEdit && this.isDirty(),\n command: { name: USER_ROLES_DISCARD_COMMAND, options: {} },\n };\n\n const saveAction: AXPLayoutDetailsViewAction = {\n title: saveTitle,\n icon: 'fa-light fa-floppy-disk',\n zone: 'footer',\n priority: 'primary',\n color: 'primary',\n visible: canEdit && this.isDirty(),\n command: { name: USER_ROLES_SAVE_COMMAND, options: {} },\n };\n\n return [discardAction, saveAction];\n }\n\n //#endregion\n\n //#region ----- Command Handling -----\n\n override execute(command: AXPExecuteCommand): void | Promise<void> {\n if (command.name === USER_ROLES_DISCARD_COMMAND) {\n this.handleDiscard();\n return;\n }\n if (command.name !== USER_ROLES_SAVE_COMMAND) {\n return;\n }\n return this.handleSaveExecute() as unknown as Promise<void>;\n }\n\n private async handleSaveExecute(): AXPCommandExecuteResultPromise {\n const userId = this.userId();\n const scope = this.grantService.resolveSessionScope();\n\n if (!userId || !scope) {\n return {\n success: false,\n message: {\n text: await this.translateService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n try {\n const roleIds = [...this.currentRoleIds()];\n const saved = await this.grantService.saveGrant({\n existing: this.existingGrant(),\n userId,\n roleIds,\n tenantId: scope.tenantId,\n applicationId: scope.applicationId,\n });\n\n const nextGrant: UserRoleGrantRow = {\n id: String(saved['id'] ?? this.existingGrant()?.id ?? ''),\n userId,\n roleIds,\n scopeInfo: (saved['scopeInfo'] as UserRoleGrantRow['scopeInfo']) ?? this.existingGrant()?.scopeInfo,\n };\n this.existingGrant.set(nextGrant.id ? nextGrant : this.existingGrant());\n this.baselineRoleIds.set([...roleIds]);\n this.currentRoleIds.set([...roleIds]);\n this.grantService.notifyGrantModified(saved);\n this.recompute();\n\n return {\n success: true,\n kind: 'object',\n data: roleIds,\n } as AXPRuntimeCommandResult;\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : 'Failed to save roles.';\n return {\n success: false,\n message: { text: message },\n };\n }\n }\n\n //#endregion\n\n //#region ----- Event Handlers -----\n\n protected onRolesValueChanged(event: AXValueChangedEvent): void {\n if (!event.isUserInteraction || this.isGrantReadonly()) {\n return;\n }\n\n const next = Array.isArray(event.value)\n ? event.value.map(String)\n : event.value != null\n ? [String(event.value)]\n : [];\n\n this.currentRoleIds.set(next);\n this.recompute();\n }\n\n private handleDiscard(): void {\n this.currentRoleIds.set([...this.baselineRoleIds()]);\n this.recompute();\n }\n\n //#endregion\n\n //#region ----- Wizard step context -----\n\n override getWizardStepContext(): Record<string, unknown> | null {\n return null;\n }\n\n //#endregion\n\n //#region ----- Data Loading -----\n\n private async loadGrantForUser(userId: string | undefined): Promise<void> {\n if (!userId) {\n this.loadedUserId.set(undefined);\n this.existingGrant.set(null);\n this.baselineRoleIds.set([]);\n this.currentRoleIds.set([]);\n this.roleOptions.set([]);\n this.isLoading.set(false);\n this.recompute();\n return;\n }\n\n if (userId === this.loadedUserId() && !this.isLoading()) {\n return;\n }\n\n this.isLoading.set(true);\n this.recompute();\n\n const scope = this.grantService.resolveSessionScope();\n if (!scope) {\n this.loadedUserId.set(userId);\n this.existingGrant.set(null);\n this.baselineRoleIds.set([]);\n this.currentRoleIds.set([]);\n this.isLoading.set(false);\n this.recompute();\n return;\n }\n\n try {\n const grant = await this.grantService.findGrant(userId, scope.tenantId, scope.applicationId);\n const roleIds = [...(grant?.roleIds ?? [])];\n const options = await this.grantService.listRoleOptions(roleIds);\n this.loadedUserId.set(userId);\n this.existingGrant.set(grant);\n this.baselineRoleIds.set(roleIds);\n this.currentRoleIds.set([...roleIds]);\n this.roleOptions.set(options);\n } catch {\n this.loadedUserId.set(userId);\n this.existingGrant.set(null);\n this.baselineRoleIds.set([]);\n this.currentRoleIds.set([]);\n this.roleOptions.set([]);\n } finally {\n this.isLoading.set(false);\n this.recompute();\n }\n }\n\n //#endregion\n\n //#region ----- Utility Methods -----\n\n private areRoleSetsEqual(a: string[], b: string[]): boolean {\n return isEqual([...a].sort(), [...b].sort());\n }\n\n protected override recompute(): void {\n super.recompute();\n const maybeLayout = this.hostPageLayout as unknown as { recompute?: () => void };\n maybeLayout?.recompute?.();\n }\n\n //#endregion\n}\n\n//#endregion\n","@if (isLoading()) {\n <!-- ----- Skeleton while UserRole grant loads for the current workspace ----- -->\n <div class=\"flex h-full min-h-0 flex-1 flex-col overflow-auto p-4\" aria-hidden=\"true\">\n <div class=\"user-roles-frame rounded border border-default bg-lightest p-4\">\n <div class=\"mb-4 h-4 w-3/5 max-w-md rounded-md overflow-hidden\">\n <ax-skeleton\n [animated]=\"true\"\n style=\"display: block; width: 100%; height: 100%\"\n ></ax-skeleton>\n </div>\n <div class=\"flex flex-col gap-3\">\n @for (widthClass of roleSkeletonPlaceholders(); track $index) {\n <!-- ----- One checkbox + label row placeholder ----- -->\n <div class=\"flex items-center gap-3\">\n <div class=\"h-4 w-4 shrink-0 rounded-sm overflow-hidden\">\n <ax-skeleton\n [animated]=\"true\"\n style=\"display: block; width: 100%; height: 100%\"\n ></ax-skeleton>\n </div>\n <div class=\"h-4 max-w-full rounded-md overflow-hidden\" [class]=\"widthClass\">\n <ax-skeleton\n [animated]=\"true\"\n style=\"display: block; width: 100%; height: 100%\"\n ></ax-skeleton>\n </div>\n </div>\n }\n </div>\n </div>\n </div>\n}\n<!-- ----- User must be persisted before role grants can be edited ----- -->\n@else if (!userId()) {\n <div class=\"flex h-full min-h-[20rem] items-center justify-center p-6\">\n <axp-state-message\n [title]=\"'@security-management:users.entities.user.pages.roles.save-user-first.title'\"\n [description]=\"'@security-management:users.entities.user.pages.roles.save-user-first.description'\"\n ></axp-state-message>\n </div>\n}\n<!-- ----- Scoped role checklist for the current tenant/application ----- -->\n@else {\n <div class=\"flex h-full min-h-0 flex-1 flex-col overflow-auto p-4\">\n <div class=\"user-roles-frame rounded border border-default bg-lightest p-4\">\n <p class=\"mb-4 text-sm opacity-70\">\n {{ '@security-management:users.entities.user.pages.roles.description' | translate | async }}\n </p>\n <ax-selection-list\n class=\"w-full\"\n valueField=\"id\"\n textField=\"title\"\n look=\"solid\"\n direction=\"vertical\"\n [multiple]=\"true\"\n [showControl]=\"true\"\n [items]=\"roleOptions()\"\n [ngModel]=\"currentRoleIds()\"\n [disabled]=\"isGrantReadonly()\"\n [readonly]=\"isGrantReadonly()\"\n (onValueChanged)=\"onRolesValueChanged($event)\"\n ></ax-selection-list>\n </div>\n </div>\n}\n","//#region ----- Imports -----\n\nimport {\n AXPPageComponentDefinition,\n AXPPageComponentProvider,\n} from '@acorex-platform/framework-client/layout/components';\nimport { USER_ROLES_PAGE_COMPONENT_KEY } from '@acorex-platform/module-security-management-client/contracts';\nimport { Injectable } from '@angular/core';\n\n//#endregion\n\n//#region ----- Provider -----\n\n@Injectable()\nexport class AXMUserRolesPageComponentProvider implements AXPPageComponentProvider {\n async components(): Promise<AXPPageComponentDefinition[]> {\n return [\n {\n key: USER_ROLES_PAGE_COMPONENT_KEY,\n loader: () =>\n import('./user-roles-page.component').then((m) => m.AXMUserRolesPageComponent),\n },\n ];\n }\n}\n\n//#endregion\n"],"names":["i2","i3","i4"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAiBA;AAEA;AAEA;;;AAGG;MAEU,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,kCAAkC,CAAC;AAC3D,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACxC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,yBAAyB,CAAC;AAiKlE,IAAA;;;IA3JC,mBAAmB,GAAA;QACjB,MAAM,QAAQ,GAAG,IAA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BAAgB;wBAChB,mBAAmB;wBACnB,SAAS;wBACT,WAAW;qBACZ,EAAA,eAAA,EAEgB,uBAAuB,CAAC,MAAM,EAAA,SAAA,EACpC;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAA,yBAA2B;AACvC,yBAAA;qBACF,EAAA,IAAA,EACK;AACJ,wBAAA,KAAK,EAAE,qDAAqD;AAC7D,qBAAA,EAAA,QAAA,EAAA,gpFAAA,EAAA;;;;;;;;AE1DH;AAEA;MAGa,iCAAiC,CAAA;AAC5C,IAAA,MAAM,UAAU,GAAA;QACd,OAAO;AACL,YAAA;AACE,gBAAA,GAAG,EAAE,6BAA6B;AAClC,gBAAA,MAAM,EAAE,MACN,uEAAqC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,yBAAyB,CAAC;AACjF,aAAA;SACF;IACH;8GATW,iCAAiC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAjC,iCAAiC,EAAA,CAAA,CAAA;;2FAAjC,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAD7C;;;"}
@@ -1,143 +0,0 @@
1
- import { AXDialogService } from '@acorex/components/dialog';
2
- import { AXToastService } from '@acorex/components/toast';
3
- import { AXTranslationService } from '@acorex/core/translation';
4
- import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
5
- import { AXPCommandService } from '@acorex-platform/framework-client/runtime';
6
- import { AXMSecurityManagementServerCommands } from '@acorex-platform/module-security-management-client/contracts';
7
- export { AXM_USER_INVITE_COMMAND } from '@acorex-platform/module-security-management-client/contracts';
8
- import * as i0 from '@angular/core';
9
- import { inject, Injectable } from '@angular/core';
10
-
11
- //#endregion
12
- //#region ---- Invite user command ----
13
- class AXPInviteUserCommand {
14
- constructor() {
15
- this.layoutBuilder = inject(AXPLayoutBuilderService);
16
- this.commandService = inject(AXPCommandService);
17
- this.dialogService = inject(AXDialogService);
18
- this.toastService = inject(AXToastService);
19
- this.translationService = inject(AXTranslationService);
20
- }
21
- async execute() {
22
- const form = await this.openInviteDialog();
23
- if (!form) {
24
- return { success: true, kind: 'object', data: { outcome: 'cancelled' } };
25
- }
26
- const webOrigin = typeof window !== 'undefined' ? window.location.origin : undefined;
27
- // Nested server call must skip toast middleware — this command owns UX toasts.
28
- let result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.InviteUser, {
29
- email: form.email,
30
- displayName: form.displayName,
31
- applicationIds: form.applicationIds,
32
- webOrigin,
33
- });
34
- const payload = result?.data;
35
- if (result?.success && payload?.userAlreadyExists && !payload.sent) {
36
- const title = await this.translationService
37
- .translateAsync('@security-management:users.entities.user.actions.invite.existing-warning-title')
38
- .catch(() => 'User Already Exists');
39
- const message = await this.translationService
40
- .translateAsync('@security-management:users.entities.user.actions.invite.existing-warning-message', {
41
- params: { email: form.email },
42
- })
43
- .catch(() => `A user with email ${form.email} already exists. Send an invitation to join this tenant?`);
44
- const confirmed = await this.dialogService.confirm(title, message, 'warning', 'horizontal');
45
- if (!confirmed.result) {
46
- return { success: true, kind: 'object', data: { outcome: 'cancelled' } };
47
- }
48
- result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.InviteUser, {
49
- email: form.email,
50
- displayName: form.displayName,
51
- applicationIds: form.applicationIds,
52
- confirmExisting: true,
53
- webOrigin,
54
- });
55
- }
56
- if (result?.success) {
57
- const [toastTitle, toastContent] = await Promise.all([
58
- this.translationService
59
- .translateAsync('@security-management:users.entities.user.actions.invite.success.title')
60
- .catch(() => 'Invitation Sent'),
61
- this.translationService
62
- .translateAsync('@security-management:users.entities.user.actions.invite.success.description')
63
- .catch(() => 'The invitation email was sent.'),
64
- ]);
65
- this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });
66
- return { success: true, kind: 'object', data: result.data };
67
- }
68
- const [toastTitle, fallback] = await Promise.all([
69
- this.translationService
70
- .translateAsync('@security-management:users.entities.user.actions.invite.error.title')
71
- .catch(() => 'Invite Failed'),
72
- this.translationService
73
- .translateAsync('@security-management:users.entities.user.actions.invite.error.description')
74
- .catch(() => 'Failed to invite user.'),
75
- ]);
76
- const toastContent = (typeof result?.message?.text === 'string' && result.message.text) || fallback;
77
- this.toastService.show({ color: 'danger', title: toastTitle, content: toastContent, timeOut: 4000 });
78
- // No `message` — outer command toast middleware would duplicate this toast.
79
- return { success: false };
80
- }
81
- async openInviteDialog() {
82
- const result = await this.layoutBuilder
83
- .create()
84
- .dialog((dialog) => {
85
- dialog
86
- .setTitle('@security-management:users.entities.user.actions.invite.dialog.title')
87
- .setSize('md')
88
- .setCloseButton(true)
89
- .setContext({ email: '', displayName: '', applicationIds: [] })
90
- .content((flex) => {
91
- flex
92
- .setDirection('column')
93
- .setGap('12px')
94
- .formField('@security-management:users.entities.user.actions.invite.fields.email', (field) => {
95
- field.path('email');
96
- field.textBox({ validations: [{ rule: 'required' }, { rule: 'email' }] });
97
- })
98
- .formField('@security-management:users.entities.user.actions.invite.fields.display-name', (field) => {
99
- field.path('displayName');
100
- field.textBox({});
101
- })
102
- .formField('@security-management:users.entities.user.actions.invite.fields.applications', (field) => {
103
- field.path('applicationIds');
104
- field.lookupBox({
105
- entity: 'ApplicationManagement.Application',
106
- multiple: true,
107
- look: 'select',
108
- });
109
- });
110
- })
111
- .setActions((actions) => {
112
- actions.cancel('@general:actions.cancel.title');
113
- actions.submit('@security-management:users.entities.user.actions.invite.dialog.submit');
114
- })
115
- .onAction(async (dialogRef) => {
116
- if (dialogRef.action() === 'cancel') {
117
- return null;
118
- }
119
- const ctx = dialogRef.context();
120
- const email = (ctx.email ?? '').trim();
121
- if (!email) {
122
- throw new Error('@security-management:users.entities.user.actions.invite.errors.email-required');
123
- }
124
- return {
125
- email,
126
- displayName: (ctx.displayName ?? '').trim() || undefined,
127
- applicationIds: Array.isArray(ctx.applicationIds) ? ctx.applicationIds : undefined,
128
- };
129
- });
130
- })
131
- .show();
132
- return resolveLayoutBuilderDialogResult(result);
133
- }
134
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPInviteUserCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
135
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPInviteUserCommand, providedIn: 'root' }); }
136
- }
137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXPInviteUserCommand, decorators: [{
138
- type: Injectable,
139
- args: [{ providedIn: 'root' }]
140
- }] });
141
-
142
- export { AXPInviteUserCommand };
143
- //# sourceMappingURL=acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/commands/invite-user.command.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport type { AXPCommand, AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXM_USER_INVITE_COMMAND,\n AXMSecurityManagementServerCommands,\n type AXMInviteUserResult,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\n//#region ---- Types ----\n\ninterface InviteFormResult {\n email: string;\n displayName?: string;\n applicationIds?: string[];\n}\n\n//#endregion\n\n//#region ---- Invite user command ----\n\n@Injectable({ providedIn: 'root' })\nexport class AXPInviteUserCommand implements AXPCommand {\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly commandService = inject(AXPCommandService);\n private readonly dialogService = inject(AXDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(): AXPCommandExecuteResultPromise {\n const form = await this.openInviteDialog();\n if (!form) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n\n const webOrigin = typeof window !== 'undefined' ? window.location.origin : undefined;\n // Nested server call must skip toast middleware — this command owns UX toasts.\n let result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.InviteUser, {\n email: form.email,\n displayName: form.displayName,\n applicationIds: form.applicationIds,\n webOrigin,\n });\n\n const payload = (result as { data?: AXMInviteUserResult })?.data;\n if (result?.success && payload?.userAlreadyExists && !payload.sent) {\n const title = await this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.existing-warning-title')\n .catch(() => 'User Already Exists');\n const message = await this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.existing-warning-message', {\n params: { email: form.email },\n })\n .catch(() => `A user with email ${form.email} already exists. Send an invitation to join this tenant?`);\n const confirmed = await this.dialogService.confirm(title, message, 'warning', 'horizontal');\n if (!confirmed.result) {\n return { success: true, kind: 'object', data: { outcome: 'cancelled' } };\n }\n result = await this.commandService.executeRemote(AXMSecurityManagementServerCommands.InviteUser, {\n email: form.email,\n displayName: form.displayName,\n applicationIds: form.applicationIds,\n confirmExisting: true,\n webOrigin,\n });\n }\n\n if (result?.success) {\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.success.title')\n .catch(() => 'Invitation Sent'),\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.success.description')\n .catch(() => 'The invitation email was sent.'),\n ]);\n this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });\n return { success: true, kind: 'object', data: result.data };\n }\n\n const [toastTitle, fallback] = await Promise.all([\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.error.title')\n .catch(() => 'Invite Failed'),\n this.translationService\n .translateAsync('@security-management:users.entities.user.actions.invite.error.description')\n .catch(() => 'Failed to invite user.'),\n ]);\n const toastContent =\n (typeof result?.message?.text === 'string' && result.message.text) || fallback;\n this.toastService.show({ color: 'danger', title: toastTitle, content: toastContent, timeOut: 4000 });\n // No `message` — outer command toast middleware would duplicate this toast.\n return { success: false };\n }\n\n private async openInviteDialog(): Promise<InviteFormResult | null> {\n const result = await this.layoutBuilder\n .create()\n .dialog<InviteFormResult | null>((dialog) => {\n dialog\n .setTitle('@security-management:users.entities.user.actions.invite.dialog.title')\n .setSize('md')\n .setCloseButton(true)\n .setContext({ email: '', displayName: '', applicationIds: [] })\n .content((flex) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .formField('@security-management:users.entities.user.actions.invite.fields.email', (field) => {\n field.path('email');\n field.textBox({ validations: [{ rule: 'required' }, { rule: 'email' }] });\n })\n .formField('@security-management:users.entities.user.actions.invite.fields.display-name', (field) => {\n field.path('displayName');\n field.textBox({});\n })\n .formField('@security-management:users.entities.user.actions.invite.fields.applications', (field) => {\n field.path('applicationIds');\n field.lookupBox({\n entity: 'ApplicationManagement.Application',\n multiple: true,\n look: 'select',\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit('@security-management:users.entities.user.actions.invite.dialog.submit');\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n const ctx = dialogRef.context() as InviteFormResult;\n const email = (ctx.email ?? '').trim();\n if (!email) {\n throw new Error('@security-management:users.entities.user.actions.invite.errors.email-required');\n }\n return {\n email,\n displayName: (ctx.displayName ?? '').trim() || undefined,\n applicationIds: Array.isArray(ctx.applicationIds) ? ctx.applicationIds : undefined,\n };\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<InviteFormResult>(result);\n }\n}\n\nexport { AXM_USER_INVITE_COMMAND };\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;AAwBA;AAEA;MAGa,oBAAoB,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AAM,IAAI,KAAK,CAAC,+EAA+E,CAAC;gBAClG;gBACA,OAAO;oBACL,KAAK;AACL,oBAAA,WAAW,EAAE,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,SAAS;AACxD,oBAAA,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,cAAc,GAAG,SAAS;iBACnF;AACH,YAAA,CAAC,CAAC;AACN,QAAA,CAAC;AACA,aAAA,IAAI,EAAE;AAET,QAAA,OAAO,gCAAgC,CAAmB,MAAM,CAAC;IACnE;8GA9HW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cADP,MAAM,EAAA,CAAA,CAAA;;2FACnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/commands/reset-two-factor.command.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXM_TWO_FACTOR_ERROR_CODES,\n AXM_USER_RESET_TWO_FACTOR_COMMAND,\n AXMSecurityManagementServerCommands,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\n//#region ----- Types -----\n\nexport interface AXPResetTwoFactorCommandInput {\n userId?: string;\n data?: {\n id?: string;\n displayName?: string;\n username?: string;\n email?: string;\n };\n}\n\n//#endregion\n\n//#region ----- Constants -----\n\nconst I18N = '@security-management:users.entities.user.actions.reset-two-factor';\n\nconst TWO_FACTOR_ERROR_I18N: Record<string, string> = {\n [AXM_TWO_FACTOR_ERROR_CODES.InvalidInput]: `${I18N}.errors.invalid-input`,\n [AXM_TWO_FACTOR_ERROR_CODES.UserNotFound]: `${I18N}.errors.user-not-found`,\n [AXM_TWO_FACTOR_ERROR_CODES.Forbidden]: `${I18N}.errors.forbidden`,\n [AXM_TWO_FACTOR_ERROR_CODES.NotEnabled]: `${I18N}.errors.not-enabled`,\n};\n\n//#endregion\n\n//#region ----- Client command -----\n\n/**\n * Admin Action on User detail: if 2FA is not enabled, warn and stop;\n * otherwise confirm, then call server AdminResetTwoFactor.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPResetTwoFactorCommand implements AXPCommand<AXPResetTwoFactorCommandInput> {\n //#region ----- Services & Dependencies -----\n\n private readonly dialogService = inject(AXDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly commandService = inject(AXPCommandService);\n\n //#endregion\n\n //#region ----- Command -----\n\n async execute(input: AXPResetTwoFactorCommandInput = {}): AXPCommandExecuteResultPromise {\n const userId = input.userId ?? input.data?.id;\n if (!userId) {\n return { success: false, message: { text: `${I18N}.errors.invalid-input` } };\n }\n\n const who =\n input.data?.displayName ||\n input.data?.username ||\n input.data?.email ||\n String(userId);\n\n // Preflight: stop before confirm when 2FA was never enabled for this user.\n const preflight = await this.commandService.executeRemote(\n AXMSecurityManagementServerCommands.AdminResetTwoFactor,\n { userId: String(userId), dryRun: true },\n );\n if (!preflight?.success) {\n await this.showFailureToast(preflight?.message?.code);\n return { success: false };\n }\n\n const confirmTitle = await this.translationService.translateAsync(`${I18N}.confirm-title`);\n const confirmMessage = await this.translationService.translateAsync(`${I18N}.confirm-message`, {\n params: { user: who },\n });\n\n const confirmed = await this.dialogService.confirm(confirmTitle, confirmMessage, 'danger', 'horizontal');\n if (!confirmed.result) {\n return { success: false };\n }\n\n const result = await this.commandService.executeRemote(\n AXMSecurityManagementServerCommands.AdminResetTwoFactor,\n { userId: String(userId) },\n );\n\n if (result?.success) {\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.success.title`),\n this.translationService.translateAsync(`${I18N}.success.description`),\n ]);\n this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });\n return { success: true, kind: 'object', data: undefined };\n }\n\n await this.showFailureToast(result?.message?.code);\n return { success: false };\n }\n\n //#endregion\n\n //#region ----- Helpers -----\n\n private async showFailureToast(code: unknown): Promise<void> {\n const codeKey = typeof code === 'string' ? code : '';\n const errorKey = TWO_FACTOR_ERROR_I18N[codeKey] || `${I18N}.error.description`;\n const isNotEnabled = codeKey === AXM_TWO_FACTOR_ERROR_CODES.NotEnabled;\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService.translateAsync(\n isNotEnabled ? `${I18N}.errors.not-enabled-title` : `${I18N}.error.title`,\n ),\n this.translationService.translateAsync(errorKey),\n ]);\n this.toastService.show({\n color: isNotEnabled ? 'warning' : 'danger',\n title: toastTitle,\n content: toastContent,\n timeOut: 4000,\n });\n }\n\n //#endregion\n}\n\nexport { AXM_USER_RESET_TWO_FACTOR_COMMAND };\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;AAwBA;AAEA;AAEA,MAAM,IAAI,GAAG,mEAAmE;AAEhF,MAAM,qBAAqB,GAA2B;AACpD,IAAA,CAAC,0BAA0B,CAAC,YAAY,GAAG,CAAA,EAAG,IAAI,CAAA,qBAAA,CAAuB;AACzE,IAAA,CAAC,0BAA0B,CAAC,YAAY,GAAG,CAAA,EAAG,IAAI,CAAA,sBAAA,CAAwB;AAC1E,IAAA,CAAC,0BAA0B,C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AA,EAAA,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"acorex-platform-module-security-management-client-send-password-reset-email.command-CoQgWdya.mjs","sources":["../../../../libs/modules/security-management/client/src/lib/commands/send-password-reset-email.command.ts"],"sourcesContent":["import { AXDialogService } from '@acorex/components/dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport { AXPRuntimeCommandResult } from '@acorex-platform/framework-shared/core';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXM_USER_SEND_PASSWORD_RESET_COMMAND,\n AXMSecurityManagementServerCommands,\n} from '@acorex-platform/module-security-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\n//#region ---- Types ----\n\nexport interface AXPSendPasswordResetEmailCommandInput {\n userId?: string;\n data?: {\n id?: string;\n displayName?: string;\n username?: string;\n email?: string;\n };\n}\n\n//#endregion\n\n//#region ---- Client command ----\n\n/**\n * Admin Action on User detail: confirm, then call server SendPasswordResetEmail.\n */\n@Injectable({ providedIn: 'root' })\nexport class AXPSendPasswordResetEmailCommand\n implements AXPCommand<AXPSendPasswordResetEmailCommandInput>\n{\n private readonly dialogService = inject(AXDialogService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly commandService = inject(AXPCommandService);\n\n async execute(input: AXPSendPasswordResetEmailCommandInput = {}): AXPCommandExecuteResultPromise {\n const userId = input.userId ?? input.data?.id;\n if (!userId) {\n return { success: false, message: { text: 'User id is required.' } };\n }\n\n const who =\n input.data?.displayName ||\n input.data?.username ||\n input.data?.email ||\n String(userId);\n\n const confirmTitle = await this.translationService\n .translateAsync('@security-management:users.entities.user.actions.send-password-reset.confirm-title')\n .catch(() => 'Send Password Reset Email');\n const confirmMessage = await this.translationService\n .translateAsync('@security-management:users.entities.user.actions.send-password-reset.confirm-message', {\n params: { user: who },\n })\n .catch(() => `Send a password reset email to ${who}?`);\n\n const confirmed = await this.dialogService.confirm(confirmTitle, confirmMessage, 'primary', 'horizontal');\n if (!confirmed.result) {\n return { success: false };\n }\n\n const webOrigin = typeof window !== 'undefined' ? window.location.origin : undefined;\n const result = await this.commandService.execute(AXMSecurityManagementServerCommands.SendPasswordResetEmail, {\n userId: String(userId),\n webOrigin,\n });\n\n if (result?.success) {\n const [toastTitle, toastContent] = await Promise.all([\n this.translationService\n .translateAsync(\n '@security-management:users.entities.user.actions.send-password-reset.success.title',\n )\n .catch(() => 'Email Sent'),\n this.translationService\n .translateAsync(\n '@security-management:users.entities.user.actions.send-password-reset.success.description',\n )\n .catch(() => 'Password reset email sent.'),\n ]);\n this.toastService.show({ color: 'success', title: toastTitle, content: toastContent, timeOut: 3000 });\n return { success: true, kind: 'object', data: undefined };\n }\n\n const [toastTitle, fallbackContent] = await Promise.all([\n this.translationService\n .translateAsync(\n '@security-management:users.entities.user.actions.send-password-reset.error.title',\n )\n .catch(() => 'Send Failed'),\n this.translationService\n .translateAsync(\n '@security-management:users.entities.user.actions.send-password-reset.error.description',\n )\n .catch(() => 'Failed to send password reset email.'),\n ]);\n const toastContent =\n (typeof result?.message?.text === 'string' && result.message.text) || fallbackContent;\n this.toastService.show({ color: 'danger', title: toastTitle, content: toastContent, timeOut: 4000 });\n return { success: false, message: { text: toastContent } };\n }\n}\n\nexport { AXM_USER_SEND_PASSWORD_RESET_COMMAND };\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;AAwBA;AAEA;AAEA;;AAEG;MAEU,gCAAgC,CAAA;AAD7C,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AACvC,QAAA,IAAA,CAAA,YAAY,GAAG,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