@masterteam/users-groups 0.0.45 → 0.0.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/users-groups",
3
- "version": "0.0.45",
3
+ "version": "0.0.46",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/users-groups",
6
6
  "linkDirectory": false,
@@ -20,9 +20,9 @@
20
20
  "tailwindcss": "^4.2.2",
21
21
  "tailwindcss-primeui": "^0.6.1",
22
22
  "@ngxs/store": "^20.1.0",
23
- "@masterteam/components": "^0.0.342",
24
- "@masterteam/icons": "^0.0.17",
25
- "@masterteam/forms": "^0.0.173"
23
+ "@masterteam/components": "^0.0.346",
24
+ "@masterteam/forms": "^0.0.173",
25
+ "@masterteam/icons": "^0.0.17"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "exports": {
@@ -1,6 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { OnInit, TemplateRef } from '@angular/core';
3
3
  import * as rxjs from 'rxjs';
4
+ import { Observable } from 'rxjs';
4
5
  import * as _masterteam_users_groups from '@masterteam/users-groups';
5
6
  import { TranslocoService } from '@jsverse/transloco';
6
7
  import { PageHeaderTab } from '@masterteam/components/page-header';
@@ -334,8 +335,13 @@ declare class UpdateUser {
334
335
  }
335
336
  declare class DeleteUser {
336
337
  userName: string | number;
338
+ acknowledgeRemainingWork: boolean;
337
339
  static readonly type = "[UsersGroups] Delete User";
338
- constructor(userName: string | number);
340
+ /**
341
+ * `acknowledgeRemainingWork`: remove the person although they still hold
342
+ * work in the application (the Replace by "Remove anyway" path).
343
+ */
344
+ constructor(userName: string | number, acknowledgeRemainingWork?: boolean);
339
345
  }
340
346
  declare class LinkUserToApplication {
341
347
  userName: string | number;
@@ -426,7 +432,7 @@ declare class UsersGroupsFacade {
426
432
  addUserToGroup(id: string, groupId: string): rxjs.Observable<void>;
427
433
  deleteUserFromGroup(payload: any): rxjs.Observable<void>;
428
434
  updateUser(id: string | undefined, changes: Partial<User>): rxjs.Observable<void>;
429
- deleteUser(userName: string | number): rxjs.Observable<void>;
435
+ deleteUser(userName: string | number, acknowledgeRemainingWork?: boolean): rxjs.Observable<void>;
430
436
  linkUserToApplication(userName: string | number): rxjs.Observable<void>;
431
437
  getUserSummary(userName: string): rxjs.Observable<void>;
432
438
  getGroupSummary(groupId: string | number): rxjs.Observable<void>;
@@ -473,7 +479,7 @@ declare class UsersGroupsState extends CrudStateBase<any, UsersGroupsStateModel,
473
479
  createUser(ctx: StateContext<UsersGroupsStateModel>, { payload }: CreateUser): rxjs.Observable<Response<User>>;
474
480
  addUserToGroup(ctx: StateContext<UsersGroupsStateModel>, { payload }: AddUserToGroup): rxjs.Observable<Response<any>>;
475
481
  updateUser(ctx: StateContext<UsersGroupsStateModel>, { changes, id }: UpdateUser): rxjs.Observable<Response<User>>;
476
- deleteUser(ctx: StateContext<UsersGroupsStateModel>, { userName }: DeleteUser): rxjs.Observable<Response<void>>;
482
+ deleteUser(ctx: StateContext<UsersGroupsStateModel>, { userName, acknowledgeRemainingWork }: DeleteUser): rxjs.Observable<Response<void>>;
477
483
  linkUserToApplication(ctx: StateContext<UsersGroupsStateModel>, { userName }: LinkUserToApplication): rxjs.Observable<Response<User | null>>;
478
484
  getUserSummary(ctx: StateContext<UsersGroupsStateModel>, { userName }: GetUserSummary): rxjs.Observable<Response<UserSummary>>;
479
485
  getGroupSummary(ctx: StateContext<UsersGroupsStateModel>, { groupId }: GetGroupSummary): rxjs.Observable<Response<GroupAccessSummary>>;
@@ -493,15 +499,26 @@ declare class UsersGroups implements OnInit {
493
499
  protected readonly facade: UsersGroupsFacade;
494
500
  private readonly route;
495
501
  private readonly router;
502
+ private readonly destroyRef;
496
503
  protected readonly translocoService: TranslocoService;
497
504
  selectedTab: _angular_core.WritableSignal<string>;
498
- tabsList: PageHeaderTab[];
505
+ /** Replacements get their own tab where this backend runs them. */
506
+ private readonly replacementsAvailable;
507
+ readonly tabsList: _angular_core.Signal<PageHeaderTab[]>;
508
+ /**
509
+ * `mt-tabs` falls back to its first option when the active value is not
510
+ * one of its options, and keeps that choice when the option appears later.
511
+ * The Replacements tab arrives once the backend answers, so hold the value
512
+ * back until its tab exists; the change then re-selects it.
513
+ */
514
+ readonly activeTab: _angular_core.Signal<string | undefined>;
499
515
  breadcrumbItems: {
500
516
  label?: string;
501
517
  routerLink?: string;
502
518
  icon?: string;
503
519
  }[];
504
520
  ngOnInit(): void;
521
+ private syncTab;
505
522
  goBack(): void;
506
523
  onTabChange(event: any): void;
507
524
  getUsers(): void;
@@ -517,6 +534,24 @@ declare class Users implements OnInit {
517
534
  private readonly toast;
518
535
  readonly modal: ModalService;
519
536
  private readonly translocoService;
537
+ private readonly replacementApi;
538
+ private readonly confirmation;
539
+ private readonly router;
540
+ private readonly route;
541
+ private readonly destroyRef;
542
+ private readonly replacementText;
543
+ /**
544
+ * Whether this backend runs replacements (`UserReplacementService.available`);
545
+ * false until known, and when the route is missing or refused (no
546
+ * CONTROL_PANEL, delegation): Replace by stays hidden. Where it runs, the
547
+ * backend also protects removal, so the trash action checks what the person
548
+ * still holds first (guide §9d). A start refused by the backend's switches
549
+ * comes back as the dialog's error.
550
+ */
551
+ readonly canReplace: _angular_core.WritableSignal<boolean>;
552
+ checkingWorkRowIds: _angular_core.WritableSignal<string[]>;
553
+ /** Person being replaced → their open replacement (`operationId`). */
554
+ readonly activeReplacements: _angular_core.WritableSignal<ReadonlyMap<string, string>>;
520
555
  users: _angular_core.Signal<User[]>;
521
556
  tabs: _angular_core.Signal<{
522
557
  label: string;
@@ -534,10 +569,17 @@ declare class Users implements OnInit {
534
569
  private allUsers;
535
570
  activeUsers: _angular_core.Signal<User[]>;
536
571
  ngOnInit(): void;
572
+ /** Who is already being replaced, so their row opens that instead. */
573
+ private loadActiveReplacements;
574
+ openReplaceDialog(user: User): void;
575
+ private openReplacement;
576
+ /** Guide §9d: remaining work decides between delete, Replace by, and no delete. */
577
+ removeWithRemainingWorkCheck(user: User): void;
578
+ private confirmPlainRemoval;
537
579
  unlockUser(user: User): void;
538
580
  isLinkedToCurrentApplication(user: any): boolean;
539
581
  linkUserToApplication(user: any): void;
540
- unlinkUserFromApplication(user: any): void;
582
+ unlinkUserFromApplication(user: any, acknowledgeRemainingWork?: boolean): void;
541
583
  addUserDialog(user?: any | null): void;
542
584
  addResetPasswordDialog(user: any): void;
543
585
  openAccessSummary(user: any): void;
@@ -628,5 +670,265 @@ declare class GroupForm implements OnInit {
628
670
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<GroupForm, "mt-group-form", never, { "groupForEdit": { "alias": "groupForEdit"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
629
671
  }
630
672
 
631
- export { AddUserToGroup, ClearSelectedGroup, CreateGroup, CreateUser, DeleteGroup, DeleteUser, DeleteUserFromGroup, GetGroup, GetGroupSummary, GetGroups, GetUser, GetUserLockStatuses, GetUserSummary, GetUsers, GroupForm, Groups, LinkUserToApplication, ResetUserPassword, UnlockUser, UpdateGroup, UpdateUser, UserForm, Users, UsersGroups, UsersGroupsActionKey, UsersGroupsFacade, UsersGroupsState };
632
- export type { Accessibility, ApiDateValue, Group, GroupAccessSummary, IdentityPrincipalRuntimeImpact, IdentityPrincipalUsage, IdentityPrincipalUsageSummary, IdentityPrincipalUsageWarning, Permission, PermissionScope, ResetUserPasswordPayload, Role, RoleLevelDataAssignment, RoleScope, RoleScopeLevel, RoleScopeModule, TranslatedField, User, UserLockStatus, UserReference, UserSummary, UserUnlockResponse, UsersGroupsStateModel };
673
+ /**
674
+ * "Replace by" (user replacement) contract, as the backend serves it under
675
+ * `api/identity/users/replacement`. Source: Pplus5.BE
676
+ * `Docs/User-Replacement/Simple-Replacement-Flow.md` and
677
+ * `Application.Abstractions/UserReplacement/UserReplacementOperationContracts.cs`.
678
+ *
679
+ * One confirmation starts a replacement; the server finds the work and hands
680
+ * it over in the background. Screens start, list, watch, show results and
681
+ * cancel. They never search for or list the person's places themselves: the
682
+ * discovery, capabilities and successor-check routes were removed. Enums come
683
+ * back as text.
684
+ */
685
+ declare const USER_REPLACEMENT_OPERATION_CONTRACT = "user-replacement-operation-v1";
686
+ /** The one confirmation. Always application-wide and transfer-only. */
687
+ interface StartReplacementRequest {
688
+ sourceUserId: string;
689
+ defaultSuccessorUserId: string;
690
+ /** Plain text, 3–1000 characters, kept in the audit trail. */
691
+ reason: string;
692
+ }
693
+ type ReplacementStatus =
694
+ /** Processing: screens show a generic message, never counts or places. */
695
+ 'Preparing'
696
+ /** The server is handing the work over. */
697
+ | 'Running' | 'Completed'
698
+ /** Finished, but some places could not be read. */
699
+ | 'CompletedWithWarnings'
700
+ /** Some work, or something the handover needs, waits for an admin. */
701
+ | 'ManualActionRequired'
702
+ /** Stopped (e.g. the starting admin lost access); never resumes by itself. */
703
+ | 'Paused' | 'Cancelled' | 'Expired'
704
+ /** Started under the old review flow and never confirmed: close and restart. */
705
+ | 'AwaitingRestart';
706
+ interface ReplacementSummary {
707
+ contractVersion: string;
708
+ operationId: string;
709
+ sourceUserId: string;
710
+ defaultSuccessorUserId: string;
711
+ status: ReplacementStatus | string;
712
+ createdAtUtc: string;
713
+ updatedAtUtc: string | null;
714
+ scannedScopeCount: number;
715
+ blockedScopeCount: number;
716
+ itemCount: number;
717
+ /** Items not handed over (or decided) yet. */
718
+ pendingItemCount: number;
719
+ itemsByResult: Record<string, number>;
720
+ canCancel: boolean;
721
+ /** Limits of the search, plus why a stopped replacement stopped. */
722
+ warningCodes: string[];
723
+ /** Always false: the search covers what the starting admin can see. */
724
+ coverageComplete: boolean;
725
+ }
726
+ type ItemDecision = 'Transfer' | 'Preserve' | 'Revoke' | 'Recalculate' | 'ManualReview';
727
+ type ItemResult = 'Applied' | 'AlreadySatisfied' | 'Preserved' | 'RequiresManualAction' | 'Conflict' | 'NotChecked';
728
+ interface ReplacementItem {
729
+ itemId: number;
730
+ store: string;
731
+ scope: string;
732
+ scopeId: number;
733
+ recordId: string;
734
+ field: string;
735
+ match: string;
736
+ decision: ItemDecision | string;
737
+ reason: string;
738
+ /** Null: not processed yet. */
739
+ resultStatus: ItemResult | string | null;
740
+ resultCode: string | null;
741
+ }
742
+ /** `nextAfterItemId` null is the last page. */
743
+ interface ReplacementResultsPage {
744
+ operationId: string;
745
+ status: ReplacementStatus | string;
746
+ items: ReplacementItem[];
747
+ nextAfterItemId: number | null;
748
+ }
749
+ interface RemainingWork {
750
+ userId: string;
751
+ handoverInProgress: boolean;
752
+ operationId: string | null;
753
+ teamRoles: number;
754
+ pendingSteps: number;
755
+ openRequests: number;
756
+ escalationSteps: number;
757
+ scheduleAssignments: number;
758
+ total: number;
759
+ safeToRemove: boolean;
760
+ }
761
+ type ReplacementListFilter = 'All' | 'Active' | 'History';
762
+ interface ReplacementListRequest {
763
+ filter: ReplacementListFilter;
764
+ /** The previous page's `nextAfterOperationId`. Keep the filters unchanged. */
765
+ afterOperationId?: string | null;
766
+ sourceUserId?: string | null;
767
+ pageSize?: number;
768
+ }
769
+ /** Newest first; `nextAfterOperationId` null is the last page. */
770
+ interface ReplacementsPage {
771
+ items: ReplacementSummary[];
772
+ nextAfterOperationId: string | null;
773
+ }
774
+ /** The server is working on these: the screens poll them. */
775
+ declare const ACTIVE_STATUSES: readonly string[];
776
+ /** Finished on its own. */
777
+ declare const FINISHED_STATUSES: readonly string[];
778
+ /** Nothing else will happen. */
779
+ declare const CLOSED_STATUSES: readonly string[];
780
+ /** Results that an admin has to finish by hand. */
781
+ declare const MANUAL_RESULTS: readonly string[];
782
+ /** The number of items an admin has to finish by hand. */
783
+ declare function manualCountOf(summary: ReplacementSummary): number;
784
+ /**
785
+ * Why a replacement stopped: the backend adds the stop code to
786
+ * `warningCodes` (a `UserReplacement_*` failure key, or
787
+ * `CollectorAuthorizationUnavailable`).
788
+ */
789
+ declare function stopCodeOf(summary: ReplacementSummary): string | null;
790
+ /**
791
+ * The text key of the Stop / Close confirmation. Nothing moves while the
792
+ * server is still finding work, so stopping then changes nothing.
793
+ */
794
+ declare function cancelConfirmKey(status: string): string;
795
+
796
+ /**
797
+ * The backend returns stable codes (failure keys, reasons, results, stores)
798
+ * and never translated text. Known codes are translated; an unknown one is
799
+ * shown as it is, never hidden.
800
+ */
801
+ declare class ReplacementText {
802
+ private readonly transloco;
803
+ constructor(transloco: TranslocoService);
804
+ t(key: string, params?: Record<string, unknown>): string;
805
+ /** Translation of `<group>.<code>`, or `fallback` when it has none. */
806
+ code(group: string, code: string | null | undefined, fallback?: string): string;
807
+ /** A failure key from the envelope's `message`, or the generic text. */
808
+ error(key: string | null | undefined): string;
809
+ /** `property-values` → the translated label, else "Property values". */
810
+ store(id: string): string;
811
+ }
812
+
813
+ interface ReplacementRow {
814
+ operationId: string;
815
+ sourceName: string;
816
+ sourceInitials: string;
817
+ successorName: string;
818
+ status: string;
819
+ statusLabel: string;
820
+ statusClass: string;
821
+ detail: string;
822
+ createdAt: string | null;
823
+ replacement: ReplacementSummary;
824
+ }
825
+ /**
826
+ * Every replacement in this application, open ones first by default: the way
827
+ * back to one after its drawer was closed, and where an abandoned one is
828
+ * closed. The only row action besides Open comes from `canCancel`.
829
+ *
830
+ * One replacement opens in a drawer over the list. Its id lives in the URL
831
+ * (`?id=`), so a refresh or a link from the Users page opens it again.
832
+ */
833
+ declare class UserReplacements implements OnInit {
834
+ private readonly api;
835
+ private readonly facade;
836
+ private readonly router;
837
+ private readonly route;
838
+ private readonly confirmation;
839
+ private readonly modal;
840
+ private readonly toast;
841
+ private readonly transloco;
842
+ private readonly destroyRef;
843
+ readonly text: ReplacementText;
844
+ /** The drawer now open, and the replacement it shows. */
845
+ private drawer;
846
+ readonly personCol: _angular_core.Signal<TemplateRef<unknown>>;
847
+ readonly statusCol: _angular_core.Signal<TemplateRef<unknown>>;
848
+ readonly startedCol: _angular_core.Signal<TemplateRef<unknown>>;
849
+ private readonly users;
850
+ private readonly language;
851
+ /** Bumped on every reload so an older page arriving late is dropped. */
852
+ private request;
853
+ /**
854
+ * All by default: most replacements finish within seconds, so "Open" alone
855
+ * would look empty right after one is started.
856
+ */
857
+ readonly filter: _angular_core.WritableSignal<ReplacementListFilter>;
858
+ readonly replacements: _angular_core.WritableSignal<ReplacementSummary[]>;
859
+ readonly nextCursor: _angular_core.WritableSignal<string | null>;
860
+ readonly loading: _angular_core.WritableSignal<boolean>;
861
+ readonly loadingMore: _angular_core.WritableSignal<boolean>;
862
+ readonly error: _angular_core.WritableSignal<string | null>;
863
+ readonly workingIds: _angular_core.WritableSignal<string[]>;
864
+ readonly tabs: _angular_core.Signal<{
865
+ label: string;
866
+ value: string;
867
+ }[]>;
868
+ readonly rows: _angular_core.Signal<ReplacementRow[]>;
869
+ readonly columns: _angular_core.Signal<ColumnDef[]>;
870
+ readonly rowActions: _angular_core.Signal<TableAction[]>;
871
+ readonly emptyTitle: _angular_core.Signal<string>;
872
+ readonly emptyDescription: _angular_core.Signal<string>;
873
+ ngOnInit(): void;
874
+ setFilter(filter: ReplacementListFilter | string): void;
875
+ reload(): Promise<void>;
876
+ loadMore(): Promise<void>;
877
+ /** Open a replacement in the drawer, through the URL. */
878
+ open(operationId: string): void;
879
+ private syncDrawer;
880
+ /** Close the drawer without touching the URL (the caller owns it). */
881
+ private dismissDrawer;
882
+ private close;
883
+ private doClose;
884
+ private refreshActive;
885
+ private replace;
886
+ private detailOf;
887
+ private nameOf;
888
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserReplacements, never>;
889
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<UserReplacements, "mt-user-replacements", never, {}, {}, never, never, true, never>;
890
+ }
891
+
892
+ /**
893
+ * HTTP calls of the Replace by flow. The flow's state is page-local (one
894
+ * replacement on one screen, the list on another), so the screens keep it in
895
+ * signals instead of the shared users-groups store.
896
+ *
897
+ * One confirmation (`start`) is all a screen sends: the server finds the work
898
+ * and hands it over in the background. The old preview routes (collect,
899
+ * accept, execute, takeover), the capabilities list and the successor check
900
+ * are gone and must not be called.
901
+ */
902
+ declare class UserReplacementService {
903
+ private readonly http;
904
+ private available$;
905
+ /**
906
+ * Whether this backend runs replacements: one small read of the list, once
907
+ * per session. False when the route is missing (an older backend) or
908
+ * refused (no CONTROL_PANEL, a delegation session): the screens then hide
909
+ * the feature. A failure is not cached, so a later screen asks again.
910
+ */
911
+ available(): Observable<boolean>;
912
+ /**
913
+ * The one confirmation: authorizes the background handover. Success means
914
+ * it was recorded, not that anything moved yet.
915
+ */
916
+ start(request: StartReplacementRequest): Observable<ReplacementSummary>;
917
+ /** Current and past replacements of this application, newest first. */
918
+ list(request: ReplacementListRequest): Observable<ReplacementsPage>;
919
+ get(operationId: string): Observable<ReplacementSummary>;
920
+ /** One page of items with their results; page size 1–200. */
921
+ results(operationId: string, afterItemId: number, pageSize?: number): Observable<ReplacementResultsPage>;
922
+ /**
923
+ * Stop or close. What was handed over stays handed over. A 409
924
+ * `UserReplacement_ProcessingBusy` means it did NOT stop: the server was
925
+ * in the middle of a step; refresh and let the admin try again.
926
+ */
927
+ cancel(operationId: string): Observable<ReplacementSummary>;
928
+ remainingWork(userId: string): Observable<RemainingWork>;
929
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<UserReplacementService, never>;
930
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<UserReplacementService>;
931
+ }
932
+
933
+ export { ACTIVE_STATUSES, AddUserToGroup, CLOSED_STATUSES, ClearSelectedGroup, CreateGroup, CreateUser, DeleteGroup, DeleteUser, DeleteUserFromGroup, FINISHED_STATUSES, GetGroup, GetGroupSummary, GetGroups, GetUser, GetUserLockStatuses, GetUserSummary, GetUsers, GroupForm, Groups, LinkUserToApplication, MANUAL_RESULTS, ResetUserPassword, USER_REPLACEMENT_OPERATION_CONTRACT, UnlockUser, UpdateGroup, UpdateUser, UserForm, UserReplacementService, UserReplacements, Users, UsersGroups, UsersGroupsActionKey, UsersGroupsFacade, UsersGroupsState, cancelConfirmKey, manualCountOf, stopCodeOf };
934
+ export type { Accessibility, ApiDateValue, Group, GroupAccessSummary, IdentityPrincipalRuntimeImpact, IdentityPrincipalUsage, IdentityPrincipalUsageSummary, IdentityPrincipalUsageWarning, ItemDecision, ItemResult, Permission, PermissionScope, RemainingWork, ReplacementItem, ReplacementListFilter, ReplacementListRequest, ReplacementResultsPage, ReplacementStatus, ReplacementSummary, ReplacementsPage, ResetUserPasswordPayload, Role, RoleLevelDataAssignment, RoleScope, RoleScopeLevel, RoleScopeModule, StartReplacementRequest, TranslatedField, User, UserLockStatus, UserReference, UserSummary, UserUnlockResponse, UsersGroupsStateModel };