Skip to content

[PM-38926] feat: Add admin change member email to v2 UpdateOrganizationUser command#7964

Draft
jrmccannon wants to merge 6 commits into
jmccannon/ac/pm-38923-update-orguser-v2from
jmccannon/ac/pm-38926-admin-change-email
Draft

[PM-38926] feat: Add admin change member email to v2 UpdateOrganizationUser command#7964
jrmccannon wants to merge 6 commits into
jmccannon/ac/pm-38923-update-orguser-v2from
jmccannon/ac/pm-38926-admin-change-email

Conversation

@jrmccannon

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-38926

📔 Objective

Adds admin change-member-email to the v2 UpdateOrganizationUserCommand, behind the pm-28365-change-member-email-no-mp (FeatureFlagKeys.ChangeMemberEmailNoMp) flag. Part of epic PM-28365 (Milestone 1: manual single-email change for members without passwords).

An org admin may change a member's email only when:

  • the member is claimed by the organization,
  • the member has no master password (TDE / Key Connector), and
  • the new email is on a domain the org has verified.

The validator (ValidateEmailChangeAsync) enforces these rules and surfaces RFC 7807 problems keyed on email; the command loads the target account, delegates the change to the Auth IChangeEmailCommand, and maps its BadRequestExceptions to typed errors. After a successful change it calls PushSyncSettingsAsync so the member's devices re-sync. Secrets Manager autoscale runs before the email write so a failed Stripe call can't leave a partial update.

Out of scope: dedicated email-changed event log (separate cross-team PR), SSO flows, members with a master password, and client UI.

Note: stacked on jmccannon/ac/pm-38923-update-orguser-v2; retarget to main once that merges.

📸 Screenshots

N/A — no UI changes.

@jrmccannon jrmccannon added the t:feature Change Type - Feature Development label Jul 10, 2026
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.93548% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.06%. Comparing base (dde4b4a) to head (eb35d0a).

Files with missing lines Patch % Lines
...Features/OrganizationUsers/UpdateUser/v2/Errors.cs 57.14% 6 Missing ⚠️
...ers/UpdateUser/v2/UpdateOrganizationUserCommand.cs 95.38% 2 Missing and 1 partial ⚠️
...s/UpdateUser/v2/UpdateOrganizationUserValidator.cs 97.05% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                             Coverage Diff                             @@
##           jmccannon/ac/pm-38923-update-orguser-v2    #7964      +/-   ##
===========================================================================
- Coverage                                    62.11%   62.06%   -0.06%     
===========================================================================
  Files                                         2281     2282       +1     
  Lines                                        99714    99898     +184     
  Branches                                      9029     9048      +19     
===========================================================================
+ Hits                                         61939    62002      +63     
- Misses                                       35586    35706     +120     
- Partials                                      2189     2190       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jrmccannon jrmccannon force-pushed the jmccannon/ac/pm-38926-admin-change-email branch from 68e4f70 to 6fb4bab Compare July 13, 2026 18:40
…onUser command

Allow an admin to change a claimed member's email via the v2 update flow when
the member has no master password and the new email is on an org-verified
domain. The validator enforces these rules and surfaces RFC 7807 problems
keyed on "email"; the command loads the account and delegates the change to
the Auth IChangeEmailCommand, mapping its BadRequestExceptions to typed errors.
@jrmccannon jrmccannon force-pushed the jmccannon/ac/pm-38926-admin-change-email branch from 6fb4bab to 075a64e Compare July 14, 2026 18:48
}

public record MemberHasMasterPasswordError()
: EmailValidationError("Cannot change the email of a member who has a master password.", "member_has_master_password");

@BTreston BTreston Jul 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrmccannon Are these the strings + Keys (and then mapped to real client owned keys) that need to be added to the client for i18n? Are these final?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of now, yes. It is the "member_has_master_password" type should be mapped over to the i18n key. I don't plan changing any of those, but if that happens i'll be sure to loop you in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants