manager icon indicating copy to clipboard operation
manager copied to clipboard

upcoming: [M3-7775] - Disable ability to edit or delete a proxy user via User Profile page

Open mjac0bs opened this issue 1 year ago โ€ข 0 comments

Description ๐Ÿ“

In Cloud Manager, a proxy user cannot be deleted, nor can its email address or username be edited once it is provisioned.

This PR is a follow up from #10103 which restricted proxy users from updating their username or email on the Display Settings page (http://localhost:3000/profile/display). There is one additional place that a proxy user could be edited, which is by visiting the User Profile page for the proxy user via URL. (The User Profile button is not visible for a proxy user on the Users & Grants page, http://localhost:3000/account/users.)

Changes ๐Ÿ”„

List any change relevant to the reviewer.

  • Disables the username and email fields and the buttons on the proxy user's profile. Displays tooltips with reason for disabling.
  • Separates out tests in change-username.spec.ts into two different files: one for the Display Settings section (display-settings.spec.ts) and another for the User Profile page (user-profile.spec.ts). This was suggested a while ago and included in the AC of another ticket in the backlog, but it was cleaner to make the switch now rather than shoehorn additional test coverage into where it didn't really belong.

Preview ๐Ÿ“ท

Before After

How to test ๐Ÿงช

Prerequisites

(How to setup test environment)

  • Check out this PR and yarn dev.
  • Make sure Parent/Child feature flag and mocks are on.

Reproduction steps

(How to reproduce the issue, if applicable)

  • Go to http://localhost:3000/account/users/ParentCompany_a1b2c3d4e5 and observe you can edit the username, email and have the ability to delete the account.
  • See also: videos.

Verification steps

(How to verify changes)

  • Change the MSW */profile endpoint to mock the proxy user as the current active user.
const profile = profileFactory.build({
      restricted: false,
      // Parent/Child: switch the `user_type` depending on what account view you need to mock.
      user_type: 'proxy',
      username: 'ParentCompany_a1b2c3d4e5',
    });
  • Go to http://localhost:3000/account/users/ParentCompany_a1b2c3d4e5) and confirm the username, email, and ability to delete the account are disabled.
  • Change the MSW */profile endpoint to mock a child user
const profile = profileFactory.build({
      restricted: false,
      // Parent/Child: switch the `user_type` depending on what account view you need to mock.
      user_type: 'child',
    });
  • Go to http://localhost:3000/account/users/ParentCompany_a1b2c3d4e5) and confirm the username, email, and ability to delete the account are disabled.
  • Confirm no regressions to User Profile page for other users (default, restricted, current active user).
  • Confirm tests pass:
yarn cy:run -s "cypress/e2e/core/account/user-profile.spec.ts, cypress/e2e/core/account/display-settings.spec.ts"

As an Author I have considered ๐Ÿค”

Check all that apply

  • [x] ๐Ÿ‘€ Doing a self review
  • [x] โ” Our contribution guidelines
  • [x] ๐Ÿค Splitting feature into small PRs
  • [x] โž• Adding a changeset
  • [x] ๐Ÿงช Providing/Improving test coverage
  • [x] ๐Ÿ” Removing all sensitive information from the code and PR description
  • [x] ๐Ÿšฉ Using a feature flag to protect the release
  • [x] ๐Ÿ‘ฃ Providing comprehensive reproduction steps
  • [ ] ๐Ÿ“‘ Providing or updating our documentation
  • [ ] ๐Ÿ•› Scheduling a pair reviewing session
  • [ ] ๐Ÿ“ฑ Providing mobile support
  • [ ] โ™ฟ Providing accessibility support

mjac0bs avatar Feb 16 '24 18:02 mjac0bs