@acorex-platform/module-security-management-client 0.0.59 → 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 (63) hide show
  1. package/fesm2022/{acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-CNHPwr3d.mjs → acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-B61j_cJF.mjs} +206 -15
  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 +170 -39
  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-DAZZcjkf.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-DAZZcjkf.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-DXhQ1_3K.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-D6g5wMQu.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-D6g5wMQu.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-DI30j3q8.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-DI30j3q8.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-zl0xsn2K.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-zl0xsn2K.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-Dv93TmJN.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-Dv93TmJN.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-H53Y7i9P.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-H53Y7i9P.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-i8zSXdbv.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-i8zSXdbv.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-Bt710bWo.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-Bt710bWo.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-LSatoTXa.mjs → acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-DuC5cfIb.mjs} +172 -41
  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 +339 -3
  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-DpAVeAIc.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 +274 -7
  54. package/fesm2022/acorex-platform-module-security-management-client-acorex-platform-module-security-management-client-CNHPwr3d.mjs.map +0 -1
  55. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-device-sessions.entity-DXhQ1_3K.mjs.map +0 -1
  56. package/fesm2022/acorex-platform-module-security-management-client-contracts-entity-catalog-users.entity-LSatoTXa.mjs.map +0 -1
  57. package/fesm2022/acorex-platform-module-security-management-client-create-user-in-tenant.command-CDtT9Ux_.mjs +0 -142
  58. package/fesm2022/acorex-platform-module-security-management-client-create-user-in-tenant.command-CDtT9Ux_.mjs.map +0 -1
  59. package/fesm2022/acorex-platform-module-security-management-client-index-DpAVeAIc.mjs.map +0 -1
  60. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs +0 -143
  61. package/fesm2022/acorex-platform-module-security-management-client-invite-user.command-kFXjLdxy.mjs.map +0 -1
  62. package/fesm2022/acorex-platform-module-security-management-client-reset-two-factor.command-psTDKoNf.mjs.map +0 -1
  63. package/fesm2022/acorex-platform-module-security-management-client-send-password-reset-email.command-CoQgWdya.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { AXPWidgetsCatalog } from '@acorex-platform/framework-shared/core';
2
- import { createAllQueryView, entityMasterCrudActions } from '@acorex-platform/framework-shared/entity';
1
+ import { AXPWidgetsCatalog, AXPSystemActionType } from '@acorex-platform/framework-shared/core';
2
+ import { createAllQueryView, entityMasterCrudActions, AXPEntityCommandScope } from '@acorex-platform/framework-shared/entity';
3
3
 
4
4
  //#region ---- User context definitions ----
5
5
  const AXM_SECURITY_CONTEXT_DEFINITIONS = [
@@ -283,6 +283,11 @@ function resolveAXMUserEffectiveState(input) {
283
283
  //#endregion
284
284
 
285
285
  //#region ---- User invitation payload on TenantUser ----
286
+ const AXM_MEMBERSHIP_INVITATION_SOURCE = {
287
+ Invite: 'invite',
288
+ JoinRequest: 'join-request',
289
+ TenantRequest: 'tenant-request',
290
+ };
286
291
  /**
287
292
  * In-app inbox definition for membership invites to users who already have a tenant.
288
293
  * Inbox row action opens the auth waiting room (Approve/Decline live there).
@@ -292,18 +297,222 @@ const AXM_MEMBERSHIP_INVITATION_NOTIFICATION_DEFINITION_KEY = 'security-manageme
292
297
  const AXM_MEMBERSHIP_INVITE_WAITING_ROOM_SOURCE = 'membership-invite';
293
298
  //#endregion
294
299
 
300
+ //#region ----- Types -----
301
+ //#endregion
302
+ //#region ----- Helpers -----
303
+ function readScopeString(value) {
304
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
305
+ }
306
+ function readInviteRoleScopeInfo(role) {
307
+ const scope = role?.scopeInfo && typeof role.scopeInfo === 'object'
308
+ ? role.scopeInfo
309
+ : undefined;
310
+ return {
311
+ tenantId: readScopeString(scope?.['tenantId']),
312
+ applicationId: readScopeString(scope?.['applicationId']),
313
+ };
314
+ }
315
+ function isHiddenRole(role) {
316
+ const state = role?.stateInfo && typeof role.stateInfo === 'object'
317
+ ? role.stateInfo
318
+ : undefined;
319
+ return state?.['isHidden'] === true;
320
+ }
321
+ /**
322
+ * Whether a Role catalog row may appear in the invite roles multi-select.
323
+ *
324
+ * UI-only selection filter (does not change Role / RLS):
325
+ * - Application invite / per-app repeater row → current-tenant + that application overlays only
326
+ * - Tenant invite → current-tenant-wide rows only (no applicationId, no other-app overlays)
327
+ */
328
+ function isRoleAssignableForInvite(role, mode, context) {
329
+ if (isHiddenRole(role)) {
330
+ return false;
331
+ }
332
+ const tenantId = context.tenantId?.trim();
333
+ if (!tenantId) {
334
+ return false;
335
+ }
336
+ const scope = readInviteRoleScopeInfo(role);
337
+ if (!scope.tenantId || scope.tenantId !== tenantId) {
338
+ return false;
339
+ }
340
+ if (mode === 'tenant') {
341
+ return !scope.applicationId;
342
+ }
343
+ const applicationId = context.applicationId?.trim();
344
+ if (!applicationId) {
345
+ return false;
346
+ }
347
+ return scope.applicationId === applicationId;
348
+ }
349
+ /**
350
+ * TM Tenant Users invite repeater only: overlay for current tenant + the
351
+ * application chosen on that row. Independent of {@link isRoleAssignableForInvite}
352
+ * so Security → Users invite can change without affecting this picker.
353
+ */
354
+ function isRoleAssignableForTenantUserInviteRow(role, context) {
355
+ if (isHiddenRole(role)) {
356
+ return false;
357
+ }
358
+ const tenantId = context.tenantId?.trim();
359
+ const applicationId = context.applicationId?.trim();
360
+ if (!tenantId || !applicationId) {
361
+ return false;
362
+ }
363
+ const scope = readInviteRoleScopeInfo(role);
364
+ return scope.tenantId === tenantId && scope.applicationId === applicationId;
365
+ }
366
+ //#endregion
367
+
368
+ //#region ----- Types -----
369
+ //#endregion
370
+ //#region ----- Helpers -----
371
+ function readId$1(value) {
372
+ if (typeof value === 'string') {
373
+ return value.trim();
374
+ }
375
+ if (value && typeof value === 'object') {
376
+ const id = value.id;
377
+ if (typeof id === 'string') {
378
+ return id.trim();
379
+ }
380
+ if (typeof id === 'number') {
381
+ return String(id);
382
+ }
383
+ return '';
384
+ }
385
+ return value != null ? String(value).trim() : '';
386
+ }
387
+ function readRoleIds$1(value) {
388
+ if (!Array.isArray(value)) {
389
+ return [];
390
+ }
391
+ return [...new Set(value.map((id) => readId$1(id)).filter(Boolean))];
392
+ }
393
+ /**
394
+ * Submit-time merge for the TM invite repeater.
395
+ * Duplicate applications (same app on two rows, different role picks) become one assignment
396
+ * with the union of role ids. Empty application rows are dropped. Do not unique the dropdown
397
+ * instead — the UI may repeat an application.
398
+ */
399
+ function normalizeInviteApplicationRoleAssignments(rows) {
400
+ if (!Array.isArray(rows)) {
401
+ return [];
402
+ }
403
+ const byApp = new Map();
404
+ for (const row of rows) {
405
+ if (!row || typeof row !== 'object') {
406
+ continue;
407
+ }
408
+ const record = row;
409
+ const applicationId = readId$1(record['applicationId']);
410
+ if (!applicationId) {
411
+ continue;
412
+ }
413
+ const bucket = byApp.get(applicationId) ?? new Set();
414
+ for (const roleId of readRoleIds$1(record['roleIds'])) {
415
+ bucket.add(roleId);
416
+ }
417
+ byApp.set(applicationId, bucket);
418
+ }
419
+ return [...byApp.entries()].map(([applicationId, roleIds]) => ({
420
+ applicationId,
421
+ roleIds: [...roleIds],
422
+ }));
423
+ }
424
+ function flattenInviteApplicationRoleAssignments(assignments) {
425
+ const applicationIds = assignments.map((row) => row.applicationId);
426
+ const roleIds = [...new Set(assignments.flatMap((row) => row.roleIds))];
427
+ return { applicationIds, roleIds };
428
+ }
429
+ //#endregion
430
+
431
+ //#region ----- Types -----
432
+ //#endregion
433
+ //#region ----- Helpers -----
434
+ function readId(value) {
435
+ if (typeof value === 'string') {
436
+ return value.trim();
437
+ }
438
+ if (value && typeof value === 'object') {
439
+ const id = value.id;
440
+ if (typeof id === 'string') {
441
+ return id.trim();
442
+ }
443
+ if (typeof id === 'number') {
444
+ return String(id);
445
+ }
446
+ return '';
447
+ }
448
+ return value != null ? String(value).trim() : '';
449
+ }
450
+ function readRoleIds(value) {
451
+ if (!Array.isArray(value)) {
452
+ return [];
453
+ }
454
+ return [...new Set(value.map((id) => readId(id)).filter(Boolean))];
455
+ }
456
+ /**
457
+ * Submit-time merge for the TM create-in-tenant repeater.
458
+ * Duplicate applications (same app on two rows, different role picks) become one assignment
459
+ * with the union of role ids. Empty application rows are dropped.
460
+ */
461
+ function normalizeCreateApplicationRoleAssignments(rows) {
462
+ if (!Array.isArray(rows)) {
463
+ return [];
464
+ }
465
+ const byApp = new Map();
466
+ for (const row of rows) {
467
+ if (!row || typeof row !== 'object') {
468
+ continue;
469
+ }
470
+ const record = row;
471
+ const applicationId = readId(record['applicationId']);
472
+ if (!applicationId) {
473
+ continue;
474
+ }
475
+ const bucket = byApp.get(applicationId) ?? new Set();
476
+ for (const roleId of readRoleIds(record['roleIds'])) {
477
+ bucket.add(roleId);
478
+ }
479
+ byApp.set(applicationId, bucket);
480
+ }
481
+ return [...byApp.entries()].map(([applicationId, roleIds]) => ({
482
+ applicationId,
483
+ roleIds: [...roleIds],
484
+ }));
485
+ }
486
+ function flattenCreateApplicationRoleAssignments(assignments) {
487
+ const applicationIds = assignments.map((row) => row.applicationId);
488
+ const roleIds = [...new Set(assignments.flatMap((row) => row.roleIds))];
489
+ return { applicationIds, roleIds };
490
+ }
491
+ //#endregion
492
+
295
493
  //#region ---- Security management server command keys ----
296
494
  const AXMSecurityManagementServerCommands = {
297
495
  SendPasswordResetEmail: 'SecurityManagement:Server:SendPasswordResetEmail',
298
496
  CompletePasswordReset: 'SecurityManagement:Server:CompletePasswordReset',
299
497
  ChangeOwnPassword: 'SecurityManagement:Server:ChangeOwnPassword',
498
+ GetOwnPasswordStatus: 'SecurityManagement:Server:GetOwnPasswordStatus',
300
499
  InviteUser: 'SecurityManagement:Server:InviteUser',
500
+ /** Tenant-subscribed applications for TM invite picker (ADR-TEN-001 D-05). */
501
+ ListTenantEntitledApplications: 'SecurityManagement:Server:ListTenantEntitledApplications',
502
+ /** Per-app Role overlays for TM invite repeater (bypasses app-catalog list isolation). */
503
+ ListInviteAssignableRoles: 'SecurityManagement:Server:ListInviteAssignableRoles',
301
504
  ResendInvitation: 'SecurityManagement:Server:ResendInvitation',
302
505
  CancelInvitation: 'SecurityManagement:Server:CancelInvitation',
303
506
  AcceptInvitation: 'SecurityManagement:Server:AcceptInvitation',
304
507
  ListMyPendingInvitations: 'SecurityManagement:Server:ListMyPendingInvitations',
305
508
  DeclineInvitation: 'SecurityManagement:Server:DeclineInvitation',
306
509
  AcceptMyInvitation: 'SecurityManagement:Server:AcceptMyInvitation',
510
+ LookupTenantByUniqueName: 'SecurityManagement:Server:LookupTenantByUniqueName',
511
+ RequestTenantMembership: 'SecurityManagement:Server:RequestTenantMembership',
512
+ ListMyJoinRequests: 'SecurityManagement:Server:ListMyJoinRequests',
513
+ CancelMyJoinRequest: 'SecurityManagement:Server:CancelMyJoinRequest',
514
+ ApproveJoinRequest: 'SecurityManagement:Server:ApproveJoinRequest',
515
+ RejectJoinRequest: 'SecurityManagement:Server:RejectJoinRequest',
307
516
  CreateUserInTenant: 'SecurityManagement:Server:CreateUserInTenant',
308
517
  StartTwoFactorEnrollment: 'SecurityManagement:Server:StartTwoFactorEnrollment',
309
518
  ConfirmTwoFactorEnrollment: 'SecurityManagement:Server:ConfirmTwoFactorEnrollment',
@@ -329,6 +538,8 @@ const AXM_USER_RESET_TWO_FACTOR_COMMAND = 'SecurityManagement:User:ResetTwoFacto
329
538
  const AXM_USER_INVITE_COMMAND = 'SecurityManagement:User:Invite';
330
539
  const AXM_USER_RESEND_INVITATION_COMMAND = 'SecurityManagement:User:ResendInvitation';
331
540
  const AXM_USER_CANCEL_INVITATION_COMMAND = 'SecurityManagement:User:CancelInvitation';
541
+ const AXM_USER_APPROVE_JOIN_REQUEST_COMMAND = 'SecurityManagement:User:ApproveJoinRequest';
542
+ const AXM_USER_REJECT_JOIN_REQUEST_COMMAND = 'SecurityManagement:User:RejectJoinRequest';
332
543
  const AXM_USER_CREATE_IN_TENANT_COMMAND = 'SecurityManagement:User:CreateInTenant';
333
544
  /** Stable codes for public invitation accept (client maps invalid/expired to the page, not a toast). */
334
545
  const AXM_ACCEPT_INVITATION_ERROR_CODES = {
@@ -336,6 +547,16 @@ const AXM_ACCEPT_INVITATION_ERROR_CODES = {
336
547
  Expired: 'ACCEPT_INVITATION_EXPIRED',
337
548
  PasswordRequired: 'ACCEPT_INVITATION_PASSWORD_REQUIRED',
338
549
  };
550
+ /** Stable codes for waiting-room join-by-unique-name (client maps to i18n). */
551
+ const AXM_JOIN_REQUEST_ERROR_CODES = {
552
+ NotSignedIn: 'JOIN_REQUEST_NOT_SIGNED_IN',
553
+ InvalidInput: 'JOIN_REQUEST_INVALID_INPUT',
554
+ TenantNotFound: 'JOIN_REQUEST_TENANT_NOT_FOUND',
555
+ AlreadyMember: 'JOIN_REQUEST_ALREADY_MEMBER',
556
+ InvitePending: 'JOIN_REQUEST_INVITE_PENDING',
557
+ RequestNotFound: 'JOIN_REQUEST_NOT_FOUND',
558
+ NotPending: 'JOIN_REQUEST_NOT_PENDING',
559
+ };
339
560
  /** Stable codes for two-factor self-service and login challenge (client maps to i18n). */
340
561
  const AXM_TWO_FACTOR_ERROR_CODES = {
341
562
  NotSignedIn: 'TWO_FACTOR_NOT_SIGNED_IN',
@@ -354,6 +575,36 @@ const AXM_TWO_FACTOR_ERROR_CODES = {
354
575
  };
355
576
  //#endregion
356
577
 
578
+ //#region ----- User provisioning settings -----
579
+ /** Platform settings owned by Security Management. */
580
+ const AXMSecurityManagementSettings = {
581
+ /**
582
+ * Which Users-list add actions are available.
583
+ * `create` and `invite` are primary. `both` shows them as secondary actions.
584
+ */
585
+ UserProvisioningMode: 'SecurityManagement:Setting:User.ProvisioningMode',
586
+ };
587
+ const AXMUserProvisioningMode = {
588
+ Create: 'create',
589
+ Invite: 'invite',
590
+ Both: 'both',
591
+ };
592
+ /** Used when the platform setting has not been saved yet. */
593
+ const AXM_USER_PROVISIONING_MODE_DEFAULT = AXMUserProvisioningMode.Both;
594
+ //#endregion
595
+
596
+ //#region ----- Device session admin scope (operation-owned) -----
597
+ /** Query `params` key and HTTP header value for admin scope. */
598
+ const AXP_DEVICE_SESSION_ADMIN_SCOPE_PARAM = 'deviceSessionAdminScope';
599
+ /** HTTP header (lowercase) carrying the same scope for getOne/update/delete. */
600
+ const AXP_DEVICE_SESSION_ADMIN_SCOPE_HEADER = 'x-axp-device-session-admin-scope';
601
+ /** Entity list view name for TM → Tenant Sessions. */
602
+ const AXP_DEVICE_SESSION_TENANT_SESSIONS_VIEW = 'tenant-sessions';
603
+ function normalizeDeviceSessionAdminScope(value) {
604
+ return value === 'tenant' ? 'tenant' : 'application';
605
+ }
606
+ //#endregion
607
+
357
608
  var AXMSessionStatusTypes;
358
609
  (function (AXMSessionStatusTypes) {
359
610
  AXMSessionStatusTypes["revoked"] = "revoked";
@@ -515,11 +766,96 @@ async function userTwoFactorFactory() {
515
766
  return entityDef;
516
767
  }
517
768
 
769
+ //#region ----- Imports -----
770
+ //#endregion
771
+ //#region ----- List actions -----
772
+ const PROVISIONING_MODE_KEY = AXMSecurityManagementSettings.UserProvisioningMode;
773
+ /**
774
+ * Hides the action unless the platform provisioning setting matches `mode`.
775
+ * A missing value uses {@link AXM_USER_PROVISIONING_MODE_DEFAULT}.
776
+ * Select widgets may persist either the scalar or `{ value }`.
777
+ */
778
+ function hiddenUnlessProvisioningMode(mode) {
779
+ return `{{ (((await settings.get('${PROVISIONING_MODE_KEY}'))?.value ?? (await settings.get('${PROVISIONING_MODE_KEY}'))) || '${AXM_USER_PROVISIONING_MODE_DEFAULT}') !== '${mode}' }}`;
780
+ }
781
+ const USER_ADD_COMMANDS = new Set([AXM_USER_INVITE_COMMAND, AXM_USER_CREATE_IN_TENANT_COMMAND]);
782
+ function commandNameOf(action) {
783
+ return typeof action.command === 'string' ? action.command : action.command?.name;
784
+ }
785
+ /** Type-level Invite / Create actions, including the legacy Create dropdown. */
786
+ function isUserProvisioningListAction(action) {
787
+ if (action.scope !== AXPEntityCommandScope.TypeLevel) {
788
+ return false;
789
+ }
790
+ if (USER_ADD_COMMANDS.has(commandNameOf(action) ?? '')) {
791
+ return true;
792
+ }
793
+ return (action.items ?? []).some((child) => USER_ADD_COMMANDS.has(commandNameOf(child) ?? ''));
794
+ }
795
+ function provisioningAction(input) {
796
+ return {
797
+ name: input.name,
798
+ title: input.title,
799
+ icon: input.icon,
800
+ command: { name: input.command },
801
+ priority: input.priority,
802
+ type: AXPSystemActionType.Create,
803
+ scope: AXPEntityCommandScope.TypeLevel,
804
+ order: input.order,
805
+ hidden: hiddenUnlessProvisioningMode(input.mode),
806
+ };
807
+ }
808
+ /**
809
+ * Users list add actions driven by the platform provisioning setting.
810
+ * Create-only and invite-only stay primary. Both are secondary menu items.
811
+ */
812
+ function userProvisioningListActions() {
813
+ return [
814
+ provisioningAction({
815
+ name: 'provision-create',
816
+ title: '@general:actions.create.title',
817
+ icon: 'fa-light fa-user-plus',
818
+ command: AXM_USER_CREATE_IN_TENANT_COMMAND,
819
+ priority: 'primary',
820
+ mode: AXMUserProvisioningMode.Create,
821
+ order: 1,
822
+ }),
823
+ provisioningAction({
824
+ name: 'provision-invite',
825
+ title: '@security-management:users.entities.user.actions.invite.title',
826
+ icon: 'fa-light fa-envelope',
827
+ command: AXM_USER_INVITE_COMMAND,
828
+ priority: 'primary',
829
+ mode: AXMUserProvisioningMode.Invite,
830
+ order: 1,
831
+ }),
832
+ provisioningAction({
833
+ name: 'provision-invite-secondary',
834
+ title: '@security-management:users.entities.user.actions.invite.title',
835
+ icon: 'fa-light fa-envelope',
836
+ command: AXM_USER_INVITE_COMMAND,
837
+ priority: 'secondary',
838
+ mode: AXMUserProvisioningMode.Both,
839
+ order: 1,
840
+ }),
841
+ provisioningAction({
842
+ name: 'provision-create-secondary',
843
+ title: '@security-management:users.entities.user.actions.create-in-tenant.title',
844
+ icon: 'fa-light fa-user-plus',
845
+ command: AXM_USER_CREATE_IN_TENANT_COMMAND,
846
+ priority: 'secondary',
847
+ mode: AXMUserProvisioningMode.Both,
848
+ order: 2,
849
+ }),
850
+ ];
851
+ }
852
+ //#endregion
853
+
518
854
  //#region ---- Contracts barrel ----
519
855
 
520
856
  /**
521
857
  * Generated bundle index. Do not edit.
522
858
  */
523
859
 
524
- export { AXMSecurityManagementServerCommands, AXMSessionStatusTypes, AXMUserAccessState, AXMUserEffectiveState, AXM_ACCEPT_INVITATION_ERROR_CODES, AXM_CHANGE_OWN_PASSWORD_ERROR_CODES, AXM_IDENTITY_PROVIDER_PROTOCOL, AXM_MEMBERSHIP_INVITATION_NOTIFICATION_DEFINITION_KEY, AXM_MEMBERSHIP_INVITE_WAITING_ROOM_SOURCE, AXM_SECURITY_CONTEXT_DEFINITIONS, AXM_TWO_FACTOR_ERROR_CODES, AXM_USER_ACCESS_STATE_DEFINITION_KEY, AXM_USER_CANCEL_INVITATION_COMMAND, AXM_USER_CREATE_IN_TENANT_COMMAND, AXM_USER_EFFECTIVE_STATE_DEFINITION_KEY, AXM_USER_INVITE_COMMAND, AXM_USER_RESEND_INVITATION_COMMAND, AXM_USER_RESET_TWO_FACTOR_COMMAND, AXM_USER_SEND_PASSWORD_RESET_COMMAND, AXPAdministrationPermissionKeys, AXPSecurityManagementFeatureKeys, AXPSecurityManagementMenuKeys, AXPSecurityManagementPermissionKeys, ROLE_PERMISSIONS_PAGE_COMPONENT_KEY, RootConfig, SecurityManagementManifest, USER_ROLES_PAGE_COMPONENT_KEY, resolveAXMUserEffectiveState, userTwoFactorFactory };
860
+ export { AXMSecurityManagementServerCommands, AXMSecurityManagementSettings, AXMSessionStatusTypes, AXMUserAccessState, AXMUserEffectiveState, AXMUserProvisioningMode, AXM_ACCEPT_INVITATION_ERROR_CODES, AXM_CHANGE_OWN_PASSWORD_ERROR_CODES, AXM_IDENTITY_PROVIDER_PROTOCOL, AXM_JOIN_REQUEST_ERROR_CODES, AXM_MEMBERSHIP_INVITATION_NOTIFICATION_DEFINITION_KEY, AXM_MEMBERSHIP_INVITATION_SOURCE, AXM_MEMBERSHIP_INVITE_WAITING_ROOM_SOURCE, AXM_SECURITY_CONTEXT_DEFINITIONS, AXM_TWO_FACTOR_ERROR_CODES, AXM_USER_ACCESS_STATE_DEFINITION_KEY, AXM_USER_APPROVE_JOIN_REQUEST_COMMAND, AXM_USER_CANCEL_INVITATION_COMMAND, AXM_USER_CREATE_IN_TENANT_COMMAND, AXM_USER_EFFECTIVE_STATE_DEFINITION_KEY, AXM_USER_INVITE_COMMAND, AXM_USER_PROVISIONING_MODE_DEFAULT, AXM_USER_REJECT_JOIN_REQUEST_COMMAND, AXM_USER_RESEND_INVITATION_COMMAND, AXM_USER_RESET_TWO_FACTOR_COMMAND, AXM_USER_SEND_PASSWORD_RESET_COMMAND, AXPAdministrationPermissionKeys, AXPSecurityManagementFeatureKeys, AXPSecurityManagementMenuKeys, AXPSecurityManagementPermissionKeys, AXP_DEVICE_SESSION_ADMIN_SCOPE_HEADER, AXP_DEVICE_SESSION_ADMIN_SCOPE_PARAM, AXP_DEVICE_SESSION_TENANT_SESSIONS_VIEW, ROLE_PERMISSIONS_PAGE_COMPONENT_KEY, RootConfig, SecurityManagementManifest, USER_ROLES_PAGE_COMPONENT_KEY, flattenCreateApplicationRoleAssignments, flattenInviteApplicationRoleAssignments, isRoleAssignableForInvite, isRoleAssignableForTenantUserInviteRow, isUserProvisioningListAction, normalizeCreateApplicationRoleAssignments, normalizeDeviceSessionAdminScope, normalizeInviteApplicationRoleAssignments, readInviteRoleScopeInfo, resolveAXMUserEffectiveState, userProvisioningListActions, userTwoFactorFactory };
525
861
  //# sourceMappingURL=acorex-platform-module-security-management-client-contracts.mjs.map