@acorex-platform/module-security-management-client 0.0.15 → 0.0.18

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.
@@ -143,6 +143,58 @@ var AXMUserEffectiveState;
143
143
  })(AXMUserEffectiveState || (AXMUserEffectiveState = {}));
144
144
  //#endregion
145
145
 
146
+ //#region ---- Resolve effective state ----
147
+ const AccountLifecycleState = {
148
+ Active: 'active',
149
+ Archived: 'archived',
150
+ Pending: 'pending',
151
+ Inactive: 'inactive',
152
+ Suspended: 'suspended',
153
+ };
154
+ /**
155
+ * Derives the unified operational state from account lifecycle and sign-in gate.
156
+ * Used for persisted `effectiveState` on SecurityManagement.User.
157
+ */
158
+ function resolveAXMUserEffectiveState(input) {
159
+ const lifecycle = input.accountState;
160
+ const auth = (input.accessState ?? AXMUserAccessState.Allowed);
161
+ if (lifecycle === AccountLifecycleState.Archived) {
162
+ return AXMUserEffectiveState.Archived;
163
+ }
164
+ if (lifecycle === AccountLifecycleState.Pending) {
165
+ return AXMUserEffectiveState.Pending;
166
+ }
167
+ if (lifecycle === AccountLifecycleState.Inactive) {
168
+ return AXMUserEffectiveState.Inactive;
169
+ }
170
+ if (lifecycle === AccountLifecycleState.Suspended) {
171
+ return AXMUserEffectiveState.Suspended;
172
+ }
173
+ if (auth === AXMUserAccessState.Expired) {
174
+ return AXMUserEffectiveState.CredentialExpired;
175
+ }
176
+ if (auth === AXMUserAccessState.Blocked) {
177
+ return AXMUserEffectiveState.SignInBlocked;
178
+ }
179
+ if (lifecycle === AccountLifecycleState.Active) {
180
+ return AXMUserEffectiveState.Active;
181
+ }
182
+ return AXMUserEffectiveState.Active;
183
+ }
184
+ //#endregion
185
+
186
+ //#region ---- Password reset payload on User ----
187
+ //#endregion
188
+
189
+ //#region ---- Security management server command keys ----
190
+ const AXMSecurityManagementServerCommands = {
191
+ SendPasswordResetEmail: 'SecurityManagement:Server:SendPasswordResetEmail',
192
+ CompletePasswordReset: 'SecurityManagement:Server:CompletePasswordReset',
193
+ };
194
+ /** Client/UI action key (confirm dialog → server send). */
195
+ const AXM_USER_SEND_PASSWORD_RESET_COMMAND = 'SecurityManagement:User:SendPasswordResetEmail';
196
+ //#endregion
197
+
146
198
  async function deviceSessionsFactory() {
147
199
  const i18n = RootConfig.config.i18n;
148
200
  const entityDef = {
@@ -1299,7 +1351,6 @@ async function rolesFactory() {
1299
1351
  }
1300
1352
 
1301
1353
  async function usersFactory() {
1302
- const i18n = RootConfig.config.i18n;
1303
1354
  const entityDef = {
1304
1355
  module: RootConfig.module.name,
1305
1356
  name: RootConfig.entities.users.name,
@@ -1352,6 +1403,7 @@ async function usersFactory() {
1352
1403
  generate: { views: { enabled: true } },
1353
1404
  },
1354
1405
  },
1406
+ { name: 'unique-fields', options: { fields: 'email', scope: 'global' } },
1355
1407
  { name: 'history' },
1356
1408
  { name: 'lock' },
1357
1409
  { name: 'compare' },
@@ -1367,10 +1419,6 @@ async function usersFactory() {
1367
1419
  title: '@general:terms.common.avatar',
1368
1420
  icon: 'fa-light fa-image',
1369
1421
  },
1370
- {
1371
- id: 'authorizations',
1372
- title: `@${i18n}:users.entities.user.groups.authorizations`,
1373
- },
1374
1422
  {
1375
1423
  id: 'user-account-access',
1376
1424
  title: '@security-management:users.entities.user.groups.account-access',
@@ -1436,12 +1484,33 @@ async function usersFactory() {
1436
1484
  },
1437
1485
  ],
1438
1486
  },
1487
+ {
1488
+ name: 'email',
1489
+ title: '@general:terms.communication.email',
1490
+ groupId: 'basic-info',
1491
+ options: {
1492
+ filter: {
1493
+ advance: { enabled: true },
1494
+ inline: { enabled: true },
1495
+ },
1496
+ sort: { enabled: true },
1497
+ },
1498
+ schema: {
1499
+ dataType: 'string',
1500
+ interface: {
1501
+ type: AXPWidgetsCatalog.text,
1502
+ options: {},
1503
+ },
1504
+ },
1505
+ validations: [{ rule: 'required' }],
1506
+ },
1439
1507
  {
1440
1508
  name: 'password',
1441
1509
  title: '@security-management:users.entities.user.fields.password.title',
1442
- groupId: 'authorizations',
1510
+ groupId: 'basic-info',
1443
1511
  schema: {
1444
1512
  dataType: 'string',
1513
+ visible: false,
1445
1514
  interface: {
1446
1515
  type: AXPWidgetsCatalog.text,
1447
1516
  },
@@ -1465,7 +1534,7 @@ async function usersFactory() {
1465
1534
  {
1466
1535
  name: 'pinCode',
1467
1536
  title: '@security-management:users.entities.user.fields.pin-code.title',
1468
- groupId: 'authorizations',
1537
+ groupId: 'basic-info',
1469
1538
  schema: {
1470
1539
  dataType: 'string',
1471
1540
  readonly: true,
@@ -1478,7 +1547,7 @@ async function usersFactory() {
1478
1547
  {
1479
1548
  name: 'roleIds',
1480
1549
  title: '@security-management:users.entities.user.fields.roles.title',
1481
- groupId: 'authorizations',
1550
+ groupId: 'basic-info',
1482
1551
  schema: {
1483
1552
  dataType: 'object',
1484
1553
  interface: {
@@ -1507,8 +1576,53 @@ async function usersFactory() {
1507
1576
  },
1508
1577
  ],
1509
1578
  },
1579
+ {
1580
+ name: 'passwordChangedAt',
1581
+ title: '@security-management:users.entities.user.fields.password-changed-at.title',
1582
+ groupId: 'user-account-access',
1583
+ schema: {
1584
+ dataType: 'date',
1585
+ readonly: true,
1586
+ nullable: true,
1587
+ interface: {
1588
+ type: AXPWidgetsCatalog.dateTime,
1589
+ },
1590
+ },
1591
+ },
1592
+ {
1593
+ name: 'lastSignInAt',
1594
+ title: '@security-management:users.entities.user.fields.last-sign-in-at.title',
1595
+ groupId: 'user-account-access',
1596
+ schema: {
1597
+ dataType: 'date',
1598
+ readonly: true,
1599
+ nullable: true,
1600
+ interface: {
1601
+ type: AXPWidgetsCatalog.dateTime,
1602
+ },
1603
+ },
1604
+ },
1605
+ {
1606
+ name: 'passwordReset',
1607
+ title: '@security-management:users.entities.user.fields.password-reset.title',
1608
+ groupId: 'user-account-access',
1609
+ schema: {
1610
+ dataType: 'object',
1611
+ readonly: true,
1612
+ visible: false,
1613
+ nullable: true,
1614
+ interface: {
1615
+ type: AXPWidgetsCatalog.text,
1616
+ },
1617
+ },
1618
+ },
1619
+ ],
1620
+ columns: [
1621
+ { name: 'username' },
1622
+ { name: 'displayName' },
1623
+ { name: 'email' },
1624
+ { name: 'roleIds', options: { dataPath: 'roles' } },
1510
1625
  ],
1511
- columns: [{ name: 'username' }, { name: 'displayName' }, { name: 'roleIds', options: { dataPath: 'roles' } }],
1512
1626
  interfaces: {
1513
1627
  master: {
1514
1628
  create: {
@@ -1523,62 +1637,29 @@ async function usersFactory() {
1523
1637
  order: 2,
1524
1638
  layout: { positions: { lg: { colSpan: 4, colStart: 9 } } },
1525
1639
  },
1526
- {
1527
- id: 'authorizations',
1528
- order: 3,
1529
- },
1530
1640
  ],
1531
1641
  properties: [
1532
1642
  {
1533
1643
  name: 'username',
1534
- layout: {
1535
- positions: {
1536
- lg: {
1537
- colSpan: 6,
1538
- },
1539
- },
1540
- },
1644
+ layout: { positions: { lg: { colSpan: 6 } } },
1541
1645
  },
1542
1646
  {
1543
1647
  name: 'displayName',
1544
- layout: {
1545
- positions: {
1546
- lg: {
1547
- colSpan: 6,
1548
- },
1549
- },
1550
- },
1648
+ layout: { positions: { lg: { colSpan: 6 } } },
1551
1649
  },
1552
1650
  {
1553
- name: 'avatar',
1554
- layout: {
1555
- label: { visible: false },
1556
- positions: {
1557
- lg: {
1558
- colSpan: 12,
1559
- order: 1,
1560
- },
1561
- },
1562
- },
1651
+ name: 'email',
1652
+ layout: { positions: { lg: { colSpan: 12 } } },
1563
1653
  },
1564
1654
  {
1565
1655
  name: 'roleIds',
1566
- layout: {
1567
- positions: {
1568
- lg: {
1569
- colSpan: 12,
1570
- },
1571
- },
1572
- },
1656
+ layout: { positions: { lg: { colSpan: 12 } } },
1573
1657
  },
1574
1658
  {
1575
- name: 'password',
1659
+ name: 'avatar',
1576
1660
  layout: {
1577
- positions: {
1578
- lg: {
1579
- colSpan: 12,
1580
- },
1581
- },
1661
+ label: { visible: false },
1662
+ positions: { lg: { colSpan: 12, order: 1 } },
1582
1663
  },
1583
1664
  },
1584
1665
  ],
@@ -1595,100 +1676,29 @@ async function usersFactory() {
1595
1676
  order: 2,
1596
1677
  layout: { positions: { lg: { colSpan: 4, colStart: 9 } } },
1597
1678
  },
1598
- {
1599
- id: 'authorizations',
1600
- order: 3,
1601
- layout: { positions: { lg: { colSpan: 12, colStart: 1 } } },
1602
- },
1603
1679
  {
1604
1680
  id: 'user-account-access',
1605
- order: 4,
1681
+ order: 3,
1606
1682
  layout: { positions: { lg: { colSpan: 12, colStart: 1 } } },
1607
1683
  },
1608
1684
  ],
1609
1685
  properties: [
1610
- {
1611
- name: 'username',
1612
- layout: {
1613
- positions: {
1614
- lg: {
1615
- colSpan: 6,
1616
- },
1617
- },
1618
- },
1619
- },
1620
- {
1621
- name: 'displayName',
1622
- layout: {
1623
- positions: {
1624
- lg: {
1625
- colSpan: 6,
1626
- },
1627
- },
1628
- },
1629
- },
1686
+ { name: 'username', layout: { positions: { lg: { colSpan: 6 } } } },
1687
+ { name: 'displayName', layout: { positions: { lg: { colSpan: 6 } } } },
1688
+ { name: 'email', layout: { positions: { lg: { colSpan: 12 } } } },
1689
+ { name: 'roleIds', layout: { positions: { lg: { colSpan: 12 } } } },
1630
1690
  {
1631
1691
  name: 'avatar',
1632
1692
  layout: {
1633
1693
  label: { visible: false },
1634
- positions: {
1635
- lg: {
1636
- colSpan: 12,
1637
- order: 1,
1638
- },
1639
- },
1640
- },
1641
- },
1642
- {
1643
- name: 'roleIds',
1644
- layout: {
1645
- positions: {
1646
- lg: {
1647
- colSpan: 12,
1648
- },
1649
- },
1650
- },
1651
- },
1652
- {
1653
- name: 'password',
1654
- layout: {
1655
- positions: {
1656
- lg: {
1657
- colSpan: 12,
1658
- },
1659
- },
1660
- },
1661
- },
1662
- {
1663
- name: 'accountState',
1664
- layout: {
1665
- positions: {
1666
- lg: {
1667
- colSpan: 4,
1668
- },
1669
- },
1670
- },
1671
- },
1672
- {
1673
- name: 'accessState',
1674
- layout: {
1675
- positions: {
1676
- lg: {
1677
- colSpan: 4,
1678
- },
1679
- },
1680
- },
1681
- },
1682
- {
1683
- name: 'effectiveState',
1684
- layout: {
1685
- positions: {
1686
- lg: {
1687
- colSpan: 4,
1688
- },
1689
- },
1694
+ positions: { lg: { colSpan: 12, order: 1 } },
1690
1695
  },
1691
1696
  },
1697
+ { name: 'accountState', layout: { positions: { lg: { colSpan: 4 } } } },
1698
+ { name: 'accessState', layout: { positions: { lg: { colSpan: 4 } } } },
1699
+ { name: 'effectiveState', layout: { positions: { lg: { colSpan: 4 } } } },
1700
+ { name: 'passwordChangedAt', layout: { positions: { lg: { colSpan: 6 } } } },
1701
+ { name: 'lastSignInAt', layout: { positions: { lg: { colSpan: 6 } } } },
1692
1702
  ],
1693
1703
  },
1694
1704
  single: {
@@ -1704,102 +1714,41 @@ async function usersFactory() {
1704
1714
  order: 2,
1705
1715
  layout: { positions: { lg: { colSpan: 4, colStart: 9 } } },
1706
1716
  },
1707
- {
1708
- id: 'authorizations',
1709
- order: 3,
1710
- layout: { positions: { lg: { colSpan: 12, colStart: 1 } } },
1711
- },
1712
1717
  {
1713
1718
  id: 'user-account-access',
1714
- order: 4,
1719
+ order: 3,
1715
1720
  layout: { positions: { lg: { colSpan: 12, colStart: 1 } } },
1716
1721
  },
1717
1722
  ],
1718
1723
  properties: [
1719
- {
1720
- name: 'username',
1721
- layout: {
1722
- positions: {
1723
- lg: {
1724
- colSpan: 6,
1725
- },
1726
- },
1727
- },
1728
- },
1729
- {
1730
- name: 'displayName',
1731
- layout: {
1732
- positions: {
1733
- lg: {
1734
- colSpan: 6,
1735
- },
1736
- },
1737
- },
1738
- },
1724
+ { name: 'username', layout: { positions: { lg: { colSpan: 6 } } } },
1725
+ { name: 'displayName', layout: { positions: { lg: { colSpan: 6 } } } },
1726
+ { name: 'email', layout: { positions: { lg: { colSpan: 12 } } } },
1727
+ { name: 'roleIds', layout: { positions: { lg: { colSpan: 12 } } } },
1739
1728
  {
1740
1729
  name: 'avatar',
1741
1730
  layout: {
1742
1731
  label: { visible: false },
1743
- positions: {
1744
- lg: {
1745
- colSpan: 12,
1746
- order: 1,
1747
- },
1748
- },
1749
- },
1750
- },
1751
- {
1752
- name: 'password',
1753
- layout: {
1754
- positions: {
1755
- lg: {
1756
- colSpan: 12,
1757
- },
1758
- },
1759
- },
1760
- },
1761
- {
1762
- name: 'roleIds',
1763
- layout: {
1764
- positions: {
1765
- lg: {
1766
- colSpan: 12,
1767
- },
1768
- },
1769
- },
1770
- },
1771
- {
1772
- name: 'accountState',
1773
- layout: {
1774
- positions: {
1775
- lg: {
1776
- colSpan: 4,
1777
- },
1778
- },
1779
- },
1780
- },
1781
- {
1782
- name: 'accessState',
1783
- layout: {
1784
- positions: {
1785
- lg: {
1786
- colSpan: 4,
1787
- },
1788
- },
1732
+ positions: { lg: { colSpan: 12, order: 1 } },
1789
1733
  },
1790
1734
  },
1735
+ { name: 'accountState', layout: { positions: { lg: { colSpan: 4 } } } },
1736
+ { name: 'accessState', layout: { positions: { lg: { colSpan: 4 } } } },
1737
+ { name: 'effectiveState', layout: { positions: { lg: { colSpan: 4 } } } },
1738
+ { name: 'passwordChangedAt', layout: { positions: { lg: { colSpan: 6 } } } },
1739
+ { name: 'lastSignInAt', layout: { positions: { lg: { colSpan: 6 } } } },
1740
+ ],
1741
+ actions: [
1791
1742
  {
1792
- name: 'effectiveState',
1793
- layout: {
1794
- positions: {
1795
- lg: {
1796
- colSpan: 4,
1797
- },
1798
- },
1799
- },
1743
+ title: '@security-management:users.entities.user.actions.send-password-reset.title',
1744
+ icon: 'fa-light fa-envelope',
1745
+ command: AXM_USER_SEND_PASSWORD_RESET_COMMAND,
1746
+ priority: 'secondary',
1747
+ type: 'view',
1748
+ scope: AXPEntityCommandScope.Individual,
1800
1749
  },
1750
+ ...entityMasterRecordActions(),
1801
1751
  ],
1802
- actions: [...entityMasterRecordActions()],
1803
1752
  },
1804
1753
  list: {
1805
1754
  actions: [...entityMasterCrudActions()],
@@ -1850,5 +1799,5 @@ async function usersFactory() {
1850
1799
  * Generated bundle index. Do not edit.
1851
1800
  */
1852
1801
 
1853
- export { AXMSecurityManagementDataSourceKeys, AXMSessionStatusTypes, AXMUserAccessState, AXMUserEffectiveState, AXM_USER_ACCESS_STATE_DEFINITION_KEY, AXM_USER_EFFECTIVE_STATE_DEFINITION_KEY, AXPSecurityManagementFeatureKeys, AXPSecurityManagementMenuKeys, AXPSecurityManagementPermissionKeys, RootConfig, deviceSessionsFactory, policyFactory, profileFactory, rolesFactory, usersFactory };
1802
+ export { AXMSecurityManagementDataSourceKeys, AXMSecurityManagementServerCommands, AXMSessionStatusTypes, AXMUserAccessState, AXMUserEffectiveState, AXM_USER_ACCESS_STATE_DEFINITION_KEY, AXM_USER_EFFECTIVE_STATE_DEFINITION_KEY, AXM_USER_SEND_PASSWORD_RESET_COMMAND, AXPSecurityManagementFeatureKeys, AXPSecurityManagementMenuKeys, AXPSecurityManagementPermissionKeys, RootConfig, deviceSessionsFactory, policyFactory, profileFactory, resolveAXMUserEffectiveState, rolesFactory, usersFactory };
1854
1803
  //# sourceMappingURL=acorex-platform-module-security-management-client-contracts.mjs.map