goalert icon indicating copy to clipboard operation
goalert copied to clipboard

Add "Merge Users" admin tool to resolve duplicates

Open mastercactapus opened this issue 1 year ago • 3 comments

What problem would you like to solve? Please describe: Duplicate users may exist in GoAlert for various reasons such as usage of multiple identity providers or a subject ID changing from OIDC. At present, the duplicate user can only be removed which may pose administrative challenges if that user is extensively configured across the application.

Describe the solution you'd like: Introduce a new admin tool called "Merge Users" that enables merging of one or more users into a "Primary" profile. The process should be all-or-nothing so all other profiles are deleted within the same transaction.

The merger should include:

  • Login sessions, assignments, contact methods, notification rules, auth subjects all merged into the "Primary" profile
  • Retaining the "Primary" profile config when it comes to basic auth conflicts (i.e., multiple usernames)
  • Adding a "(merged)" suffix to Contact Method names to resolve any overlapping.

A GraphQL mutation mergeUsers(primary: ID!, toMerge: [ID!]!) should be added for this process.

Describe alternatives you've considered: The current alternative is removing the duplicate user. However, this solution is inelegant and may lead to complications if the removed user has extensive links across the application.

Additional context: In future enhancements, implementing a search/detection tool for potential duplicates could serve as an effective supplement to the "Merge Users" tool.

mastercactapus avatar Dec 12 '23 18:12 mastercactapus

Rough design proposal:

┌───────────────────────────────────────────────────────────────────────────┐
│/admin/merge-users?users=<uuid1>&users<uuid2>&users=<uuid3>                │
├───────────────────────────────────────────────────────────────────────────┤
│                                                                           │
│  Admin / Merge Users                                          ┌─────────┐ │
│                                                               │  MERGE  │ │
│                                                               └─────────┘ │
│                                                                           │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Primary                       UserID: "uuid1"                 <Remove>│ │
│ │                                                                       │ │
│ │  User.Name1  [Link, new tab]                                          │ │
│ │  User.Email1                 Auth Subjects:                           │ │
│ │                                  oidc: z12345                         │ │
│ │  0 Active Sessions             github: 123423                         │ │
│ │  2 Contact Methods                                                    │ │
│ │  4 Assignments                                                        │ │
│ │  1 Notification Rule                                                  │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
│                                                                           │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ <Make Primary>  (moves to top) UserID: "uuid2"                <Remove>│ │
│ │                                                                       │ │
│ │  User.Name2  [Link, new tab]                                          │ │
│ │  User.Email2                 Auth Subjects:                           │ │
│ │                                  oidc: z12345                         │ │
│ │  0 Active Sessions             github: 123423                         │ │
│ │  2 Contact Methods                                                    │ │
│ │  4 Assignments                                                        │ │
│ │  1 Notification Rule                                                  │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
│                                                                           │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ <Make Primary>  (moves to top) UserID: "uuid3"                <Remove>│ │
│ │                                                                       │ │
│ │  User.Name3  [Link, new tab]                                          │ │
│ │  User.Email3                 Auth Subjects:                           │ │
│ │                                  oidc: z12345                         │ │
│ │  0 Active Sessions             github: 123423                         │ │
│ │  2 Contact Methods                                                    │ │
│ │  4 Assignments                                                        │ │
│ │  1 Notification Rule                                                  │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
│                                                                           │
│                                                                    ┌───┐  │
│                                                                    │ + │  │
│                                                                    └───┘  │
│                                                                           │
└───────────────────────────────────────────────────────────────────────────┘

mastercactapus avatar Dec 12 '23 18:12 mastercactapus

"Add user to merge" dialog thoughts:

┌────────────────────────────────────────────────────────────────────┐
│     Add User to Merge                                              │
│                                                                    │
│    ┌─────────────────────────┐                                     │
│    │ Search Select           │                                     │
│    └─────────────────────────┘                                     │
│                                                                    │
│   By ID (paste ID or URL)                                          │
│    ┌─────────────────────────┐                                     │
│    │                         │                                     │
│    └─────────────────────────┘                                     │
│                                                                    │
│   ┌───────────────────────────────────────────┐                    │
│   │ User.Name                                 │                    │
│   │ User.Email                                │                    │
│   │                                           │                    │
│   │                                           │                    │
│   │                                           │                    │
│   │   (card should be a read-only version     │                    │
│   │    of the one on the parent page)         │      ┌────────┐    │
│   │                                           │      │ Submit │    │
│   └───────────────────────────────────────────┘      └────────┘    │
│                                                                    │
└────────────────────────────────────────────────────────────────────┘

mastercactapus avatar Dec 12 '23 18:12 mastercactapus

These look good! We could probably put the "Add" button next to "Merge", using an outlined button group like we have in other spots around GoAlert

Also as an aside @mastercactapus, it may be worth checking out UI libraries such as Figma or Adobe XD to simplify and clean up UI mockups! You can import Material UI components and drag and drop them where you want.

Forfold avatar Dec 12 '23 20:12 Forfold