Skip to content

graphqlbackend: allow non-admin users to update other metadata when site config prohibits username changes

Administrator requested to merge cloud/fix-update-user into main

Created by: flying-robot

Non-admin users are currently prevented from updating their display name and avatar URL if the site configuration prohibits username changes. There are a number of additional factors in play:

  1. The UI will always include username in the mutation payload.
  2. That triggers the viewerCanChangeUsername check, since args.Username is not null.
  3. viewerCanChangeUsername falls through to the final site admin check, and the request fails.

Here is the intended design, as I understand it:

Screen Shot 2020-11-12 at 7 10 18 AM

The test was written first to demonstrate a failing case, and then viewerIsChangingUsername was introduced to short circuit if appropriate.

fixes https://github.com/sourcegraph/sourcegraph/issues/15663

Merge request reports

Loading