@dloizides/ui-access-admin 1.2.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,7 +5,24 @@ All notable changes to `@dloizides/ui-access-admin` are documented here.
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the
6
6
  project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.2.1]
8
+ ## [1.4.0]
9
+
10
+ ### Changed
11
+
12
+ - `UserManagementApi.createUser` and `resetPassword` are optional. Without `createUser` the panel hides Create; without `resetPassword` it hides each row's Reset password (FINREG-FUNDS-1 "Tenant funds, deal gate, blocking and roles"). Non-breaking.
13
+
14
+ ## [1.3.0]
15
+
16
+ ### Added
17
+
18
+ - `PermissionMatrix`: read-only roles x permissions view (FINREG-FUNDS-1 "Tenant funds, deal gate, blocking and roles", AC-R2). Data injected; one card per role below `LAYOUT_COLLAPSE_BREAKPOINT`, a table above it.
19
+ - `UserManagementPanel` edit modal: a required block reason when Active is off, sent as `blockedReason` (AC-B1). New `UserManagementPatch` type; `UserManagementUser.blockedReason`.
20
+
21
+ ### Changed
22
+
23
+ - Peer `@dloizides/ui-layout` raised to `>=1.27.0` (needs `LAYOUT_COLLAPSE_BREAKPOINT`).
24
+
25
+ ## [1.2.2]
9
26
 
10
27
  ### Fixed
11
28
 
package/dist/index.d.mts CHANGED
@@ -336,26 +336,29 @@ interface UserManagementUser {
336
336
  /** The tenant this user belongs to, or null for a platform-level account. */
337
337
  tenantId: string | null;
338
338
  active: boolean;
339
+ blockedReason?: string | null;
339
340
  /** ISO timestamp the user was created, when the directory reports it. */
340
341
  createdAt?: string;
341
342
  }
343
+ interface UserManagementPatch {
344
+ displayName?: string;
345
+ role?: string;
346
+ tenantId?: string | null;
347
+ active?: boolean;
348
+ blockedReason?: string;
349
+ }
342
350
  /** What the host is asked to do. Each rejects with an `Error` on failure. */
343
351
  interface UserManagementApi {
344
352
  listUsers(): Promise<UserManagementUser[]>;
345
- createUser(input: {
353
+ createUser?(input: {
346
354
  email: string;
347
355
  password: string;
348
356
  displayName: string;
349
357
  role: string;
350
358
  tenantId: string | null;
351
359
  }): Promise<void>;
352
- updateUser(id: string, patch: {
353
- displayName?: string;
354
- role?: string;
355
- tenantId?: string | null;
356
- active?: boolean;
357
- }): Promise<void>;
358
- resetPassword(id: string, password: string): Promise<void>;
360
+ updateUser(id: string, patch: UserManagementPatch): Promise<void>;
361
+ resetPassword?(id: string, password: string): Promise<void>;
359
362
  }
360
363
  /** One selectable tenant for the platform-admin tenant picker. */
361
364
  interface UserManagementTenant {
@@ -403,6 +406,37 @@ interface UserManagementPanelProps {
403
406
 
404
407
  declare const UserManagementPanel: ({ api, isPlatformAdmin, assignableRoles, tenants, t, testID, }: UserManagementPanelProps) => React.ReactElement;
405
408
 
409
+ type PermissionMatrixTranslate = (key: string, p1?: string, p2?: string, p3?: string) => string;
410
+ interface PermissionMatrixRole {
411
+ readonly id: string;
412
+ readonly label: string;
413
+ }
414
+ interface PermissionMatrixPermission {
415
+ readonly id: string;
416
+ readonly label: string;
417
+ }
418
+ type PermissionMatrixGrants = Readonly<Record<string, readonly string[] | undefined>>;
419
+ interface PermissionMatrixCell {
420
+ readonly permission: PermissionMatrixPermission;
421
+ readonly granted: boolean;
422
+ }
423
+ interface PermissionMatrixColumn {
424
+ readonly role: PermissionMatrixRole;
425
+ readonly cells: readonly PermissionMatrixCell[];
426
+ readonly grantedCount: number;
427
+ }
428
+ interface PermissionMatrixProps {
429
+ readonly roles: readonly PermissionMatrixRole[];
430
+ readonly permissions: readonly PermissionMatrixPermission[];
431
+ readonly grants: PermissionMatrixGrants;
432
+ readonly t: PermissionMatrixTranslate;
433
+ readonly testID?: string;
434
+ }
435
+
436
+ declare const PermissionMatrix: ({ roles, permissions, grants, t, testID, }: PermissionMatrixProps) => React.ReactElement;
437
+
438
+ declare function buildPermissionMatrix(roles: readonly PermissionMatrixRole[], permissions: readonly PermissionMatrixPermission[], grants: PermissionMatrixGrants): PermissionMatrixColumn[];
439
+
406
440
  /** Translate function — mirrors the fleet's `FM(key, p1?, p2?, p3?)` shape. */
407
441
  type AccessTranslate = (key: string, p1?: string, p2?: string, p3?: string) => string;
408
442
  interface UseCapabilityLinkMintOptions {
@@ -702,6 +736,18 @@ declare const ACCESS_ADMIN_I18N: {
702
736
  readonly usersUpdateFailed: "accessAdmin.users.updateFailed";
703
737
  readonly usersResetSuccess: "accessAdmin.users.resetSuccess";
704
738
  readonly usersResetFailed: "accessAdmin.users.resetFailed";
739
+ readonly usersFieldBlockedReason: "accessAdmin.users.fieldBlockedReason";
740
+ readonly usersBlockedReasonPlaceholder: "accessAdmin.users.blockedReasonPlaceholder";
741
+ readonly usersBlockedReasonHint: "accessAdmin.users.blockedReasonHint";
742
+ readonly permissionsHeading: "accessAdmin.permissions.heading";
743
+ readonly permissionsNote: "accessAdmin.permissions.note";
744
+ readonly permissionsColPermission: "accessAdmin.permissions.colPermission";
745
+ readonly permissionsGranted: "accessAdmin.permissions.granted";
746
+ readonly permissionsNotGranted: "accessAdmin.permissions.notGranted";
747
+ readonly permissionsCellLabel: "accessAdmin.permissions.cellLabel";
748
+ readonly permissionsReadOnlyHint: "accessAdmin.permissions.readOnlyHint";
749
+ readonly permissionsRoleCount: "accessAdmin.permissions.roleCount";
750
+ readonly permissionsEmpty: "accessAdmin.permissions.empty";
705
751
  };
706
752
  /** The shape of {@link ACCESS_ADMIN_I18N} — useful for typing an override map. */
707
753
  type AccessAdminI18n = typeof ACCESS_ADMIN_I18N;
@@ -714,6 +760,7 @@ declare const ACCESS_ADMIN_TEST_IDS: {
714
760
  readonly linkPanel: "access-link-panel";
715
761
  readonly accountPanel: "account-link-panel";
716
762
  readonly usersPanel: "user-management-panel";
763
+ readonly permissionMatrix: "permission-matrix";
717
764
  };
718
765
 
719
- export { ACCESS_ADMIN_I18N, ACCESS_ADMIN_TEST_IDS, type AccessAdminI18n, type AccessAdminPalette, AccessLinkPanel, type AccessLinkPanelProps, type AccessResultReporter, AccessResultTone, type AccessSubject, type AccessTranslate, AccountLinkPanel, type AccountLinkPanelProps, type CapabilityLink, type CapabilityLinkMintState, type DescribeError, type ExpiryPolicy, type LinkSubjectAccount, type LinkableAccount, type MintCapabilityLink, type MintCapabilityLinkInput, type SubjectAccountLinkState, type UseCapabilityLinkMintOptions, type UseSubjectAccountLinkOptions, type UserManagementApi, UserManagementPanel, type UserManagementPanelProps, type UserManagementTenant, type UserManagementTranslate, type UserManagementUser, accountDisplayLabel, activeLinksForSubject, buildAccountOptions, buildCapabilityLinkMailto, capabilityExpiryDate, capabilityExpiryDays, daysUntilAnchor, formatLinkDate, linksForSubject, useAccessAdminPalette, useCapabilityLinkMint, useSubjectAccountLink };
766
+ export { ACCESS_ADMIN_I18N, ACCESS_ADMIN_TEST_IDS, type AccessAdminI18n, type AccessAdminPalette, AccessLinkPanel, type AccessLinkPanelProps, type AccessResultReporter, AccessResultTone, type AccessSubject, type AccessTranslate, AccountLinkPanel, type AccountLinkPanelProps, type CapabilityLink, type CapabilityLinkMintState, type DescribeError, type ExpiryPolicy, type LinkSubjectAccount, type LinkableAccount, type MintCapabilityLink, type MintCapabilityLinkInput, PermissionMatrix, type PermissionMatrixColumn, type PermissionMatrixGrants, type PermissionMatrixPermission, type PermissionMatrixProps, type PermissionMatrixRole, type PermissionMatrixTranslate, type SubjectAccountLinkState, type UseCapabilityLinkMintOptions, type UseSubjectAccountLinkOptions, type UserManagementApi, UserManagementPanel, type UserManagementPanelProps, type UserManagementPatch, type UserManagementTenant, type UserManagementTranslate, type UserManagementUser, accountDisplayLabel, activeLinksForSubject, buildAccountOptions, buildCapabilityLinkMailto, buildPermissionMatrix, capabilityExpiryDate, capabilityExpiryDays, daysUntilAnchor, formatLinkDate, linksForSubject, useAccessAdminPalette, useCapabilityLinkMint, useSubjectAccountLink };
package/dist/index.d.ts CHANGED
@@ -336,26 +336,29 @@ interface UserManagementUser {
336
336
  /** The tenant this user belongs to, or null for a platform-level account. */
337
337
  tenantId: string | null;
338
338
  active: boolean;
339
+ blockedReason?: string | null;
339
340
  /** ISO timestamp the user was created, when the directory reports it. */
340
341
  createdAt?: string;
341
342
  }
343
+ interface UserManagementPatch {
344
+ displayName?: string;
345
+ role?: string;
346
+ tenantId?: string | null;
347
+ active?: boolean;
348
+ blockedReason?: string;
349
+ }
342
350
  /** What the host is asked to do. Each rejects with an `Error` on failure. */
343
351
  interface UserManagementApi {
344
352
  listUsers(): Promise<UserManagementUser[]>;
345
- createUser(input: {
353
+ createUser?(input: {
346
354
  email: string;
347
355
  password: string;
348
356
  displayName: string;
349
357
  role: string;
350
358
  tenantId: string | null;
351
359
  }): Promise<void>;
352
- updateUser(id: string, patch: {
353
- displayName?: string;
354
- role?: string;
355
- tenantId?: string | null;
356
- active?: boolean;
357
- }): Promise<void>;
358
- resetPassword(id: string, password: string): Promise<void>;
360
+ updateUser(id: string, patch: UserManagementPatch): Promise<void>;
361
+ resetPassword?(id: string, password: string): Promise<void>;
359
362
  }
360
363
  /** One selectable tenant for the platform-admin tenant picker. */
361
364
  interface UserManagementTenant {
@@ -403,6 +406,37 @@ interface UserManagementPanelProps {
403
406
 
404
407
  declare const UserManagementPanel: ({ api, isPlatformAdmin, assignableRoles, tenants, t, testID, }: UserManagementPanelProps) => React.ReactElement;
405
408
 
409
+ type PermissionMatrixTranslate = (key: string, p1?: string, p2?: string, p3?: string) => string;
410
+ interface PermissionMatrixRole {
411
+ readonly id: string;
412
+ readonly label: string;
413
+ }
414
+ interface PermissionMatrixPermission {
415
+ readonly id: string;
416
+ readonly label: string;
417
+ }
418
+ type PermissionMatrixGrants = Readonly<Record<string, readonly string[] | undefined>>;
419
+ interface PermissionMatrixCell {
420
+ readonly permission: PermissionMatrixPermission;
421
+ readonly granted: boolean;
422
+ }
423
+ interface PermissionMatrixColumn {
424
+ readonly role: PermissionMatrixRole;
425
+ readonly cells: readonly PermissionMatrixCell[];
426
+ readonly grantedCount: number;
427
+ }
428
+ interface PermissionMatrixProps {
429
+ readonly roles: readonly PermissionMatrixRole[];
430
+ readonly permissions: readonly PermissionMatrixPermission[];
431
+ readonly grants: PermissionMatrixGrants;
432
+ readonly t: PermissionMatrixTranslate;
433
+ readonly testID?: string;
434
+ }
435
+
436
+ declare const PermissionMatrix: ({ roles, permissions, grants, t, testID, }: PermissionMatrixProps) => React.ReactElement;
437
+
438
+ declare function buildPermissionMatrix(roles: readonly PermissionMatrixRole[], permissions: readonly PermissionMatrixPermission[], grants: PermissionMatrixGrants): PermissionMatrixColumn[];
439
+
406
440
  /** Translate function — mirrors the fleet's `FM(key, p1?, p2?, p3?)` shape. */
407
441
  type AccessTranslate = (key: string, p1?: string, p2?: string, p3?: string) => string;
408
442
  interface UseCapabilityLinkMintOptions {
@@ -702,6 +736,18 @@ declare const ACCESS_ADMIN_I18N: {
702
736
  readonly usersUpdateFailed: "accessAdmin.users.updateFailed";
703
737
  readonly usersResetSuccess: "accessAdmin.users.resetSuccess";
704
738
  readonly usersResetFailed: "accessAdmin.users.resetFailed";
739
+ readonly usersFieldBlockedReason: "accessAdmin.users.fieldBlockedReason";
740
+ readonly usersBlockedReasonPlaceholder: "accessAdmin.users.blockedReasonPlaceholder";
741
+ readonly usersBlockedReasonHint: "accessAdmin.users.blockedReasonHint";
742
+ readonly permissionsHeading: "accessAdmin.permissions.heading";
743
+ readonly permissionsNote: "accessAdmin.permissions.note";
744
+ readonly permissionsColPermission: "accessAdmin.permissions.colPermission";
745
+ readonly permissionsGranted: "accessAdmin.permissions.granted";
746
+ readonly permissionsNotGranted: "accessAdmin.permissions.notGranted";
747
+ readonly permissionsCellLabel: "accessAdmin.permissions.cellLabel";
748
+ readonly permissionsReadOnlyHint: "accessAdmin.permissions.readOnlyHint";
749
+ readonly permissionsRoleCount: "accessAdmin.permissions.roleCount";
750
+ readonly permissionsEmpty: "accessAdmin.permissions.empty";
705
751
  };
706
752
  /** The shape of {@link ACCESS_ADMIN_I18N} — useful for typing an override map. */
707
753
  type AccessAdminI18n = typeof ACCESS_ADMIN_I18N;
@@ -714,6 +760,7 @@ declare const ACCESS_ADMIN_TEST_IDS: {
714
760
  readonly linkPanel: "access-link-panel";
715
761
  readonly accountPanel: "account-link-panel";
716
762
  readonly usersPanel: "user-management-panel";
763
+ readonly permissionMatrix: "permission-matrix";
717
764
  };
718
765
 
719
- export { ACCESS_ADMIN_I18N, ACCESS_ADMIN_TEST_IDS, type AccessAdminI18n, type AccessAdminPalette, AccessLinkPanel, type AccessLinkPanelProps, type AccessResultReporter, AccessResultTone, type AccessSubject, type AccessTranslate, AccountLinkPanel, type AccountLinkPanelProps, type CapabilityLink, type CapabilityLinkMintState, type DescribeError, type ExpiryPolicy, type LinkSubjectAccount, type LinkableAccount, type MintCapabilityLink, type MintCapabilityLinkInput, type SubjectAccountLinkState, type UseCapabilityLinkMintOptions, type UseSubjectAccountLinkOptions, type UserManagementApi, UserManagementPanel, type UserManagementPanelProps, type UserManagementTenant, type UserManagementTranslate, type UserManagementUser, accountDisplayLabel, activeLinksForSubject, buildAccountOptions, buildCapabilityLinkMailto, capabilityExpiryDate, capabilityExpiryDays, daysUntilAnchor, formatLinkDate, linksForSubject, useAccessAdminPalette, useCapabilityLinkMint, useSubjectAccountLink };
766
+ export { ACCESS_ADMIN_I18N, ACCESS_ADMIN_TEST_IDS, type AccessAdminI18n, type AccessAdminPalette, AccessLinkPanel, type AccessLinkPanelProps, type AccessResultReporter, AccessResultTone, type AccessSubject, type AccessTranslate, AccountLinkPanel, type AccountLinkPanelProps, type CapabilityLink, type CapabilityLinkMintState, type DescribeError, type ExpiryPolicy, type LinkSubjectAccount, type LinkableAccount, type MintCapabilityLink, type MintCapabilityLinkInput, PermissionMatrix, type PermissionMatrixColumn, type PermissionMatrixGrants, type PermissionMatrixPermission, type PermissionMatrixProps, type PermissionMatrixRole, type PermissionMatrixTranslate, type SubjectAccountLinkState, type UseCapabilityLinkMintOptions, type UseSubjectAccountLinkOptions, type UserManagementApi, UserManagementPanel, type UserManagementPanelProps, type UserManagementPatch, type UserManagementTenant, type UserManagementTranslate, type UserManagementUser, accountDisplayLabel, activeLinksForSubject, buildAccountOptions, buildCapabilityLinkMailto, buildPermissionMatrix, capabilityExpiryDate, capabilityExpiryDays, daysUntilAnchor, formatLinkDate, linksForSubject, useAccessAdminPalette, useCapabilityLinkMint, useSubjectAccountLink };