Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [M3-7817] - Show correct status of Child Account Enabled column for parent users #10233

Merged

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented Feb 27, 2024

Description 📝

We need to fix our conditional that is rendering either "Disabled" or "Enabled" in the Child Account Access column of the Users & Grants table. This grant can be set for restricted parent users, by an unrestricted parent user, to determine whether that restricted parent can access child accounts.

Currently, Child Account Access on http://localhost:3000/account/users is “Disabled” for unrestricted parent users, which is not correct; it should be “Enabled”. This was a logic error - our check for grants is going to return undefined (and evaluate to "Disabled") for unrestricted parent users because we don't check grants for unrestricted users.

We should also confirm that the Child Account Access column updates as expected (to "Enabled") after a restricted parent is granted access.

Changes 🔄

  • Adds a restricted user check and flips the Disabled/Enabled conditional result.
  • Invalidates the grants query for the current user when global permissions are changed so current data is fetched.

Note

Test coverage for these changes will be in the related test ticket, M3-7500. (#10240)

Preview 📷

Before After
Screenshot 2024-02-28 at 9 00 20 AM Screenshot 2024-03-08 at 7 57 03 AM Screenshot 2024-03-08 at 7 35 42 AM Screenshot 2024-03-08 at 7 56 02 AM Screenshot 2024-03-08 at 7 36 56 AM

|

How to test 🧪

Prerequisites

(How to setup test environment)

  • Turn on the feature flag for Parent Child Accounts.
  • To get access to a parent account login, contact me.
  • On your parent account, create two other parent users: one will full account access unrestricted-parent-user and another without full account access restricted-parent-user.

Reproduction steps

(How to reproduce the issue, if applicable)

  • Using our dev environment, log into a parent account and go to the Users & Grants page.
  • Observe that the Child Account Access column shows "Disabled" for a unrestricted parent user.

Verification steps

(How to verify changes)

  • Check out this PR, yarn dev and switch to the dev environment.
  • Log into a parent account and go to http://localhost:3000/account/users.
  • Verify the following:
    • For an unrestricted parent user, the Child Account Access column displays Enabled. (You can create a new parent user with full account access to test.)
    • For a restricted parent user, the Child Account Access column displays Enabled if the child_account_access grant is true and Disabled if the child_account_access grant is false.
      • Go to the User Permissions page of the restricted-parent-user and toggle the "Enable child account access" general permission. Then go back to the Users Landing page and confirm the value has updated as expected.
    • For all other users, the Child Account Access column is not visible.

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@mjac0bs mjac0bs added the Bug Fixes for regressions or bugs label Feb 28, 2024
@mjac0bs mjac0bs force-pushed the M3-7817-correct-child-account-access-status branch from 297b524 to 0aea463 Compare February 28, 2024 17:41
@mjac0bs mjac0bs marked this pull request as ready for review March 8, 2024 15:59
@mjac0bs mjac0bs requested a review from a team as a code owner March 8, 2024 15:59
@mjac0bs mjac0bs requested review from jdamore-linode and carrillo-erik and removed request for a team March 8, 2024 15:59
@mjac0bs mjac0bs requested a review from jaalah-akamai March 8, 2024 16:00
@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Ready for Review labels Mar 8, 2024
Copy link

github-actions bot commented Mar 8, 2024

Coverage Report:
Base Coverage: 81.4%
Current Coverage: 81.4%

@mjac0bs
Copy link
Contributor Author

mjac0bs commented Mar 8, 2024

CI failure was on volumes/delete-volume.spec.ts, which is unrelated to these changes. Merging now.

@mjac0bs mjac0bs merged commit 0a6c1ad into linode:develop Mar 8, 2024
17 of 18 checks passed
vrajesh73 added a commit to vrajesh73/manager that referenced this pull request Mar 12, 2024
…eature/namespace-create

* 'develop' of https://github.com/vrajesh73/manager: (89 commits)
  fix: [M3-7269] - Display parent email in user menu when no company name is available for restricted parent user (linode#10248)
  fix: [M3-7817] - Show correct status of Child Account Enabled column for parent users (linode#10233)
  upcoming: [M3-7616] - Add Placement Groups Events and Notifications (linode#10221)
  upcoming: [M3-7816-v2] - Adjust logic for when to show Switch Account button (linode#10266)
  fix: [M3-7831] - Persisting error messages in ACLB delete dialogs (linode#10254)
  upcoming: [M3-7842] - Update Assign Linode Drawer and improve query skipping (linode#10263)
  upcoming: [M3-7704] - Disable Cloning, Private IP, Backups for edge regions (linode#10222)
  test: Fix test flake for Images landing page test (linode#10267)
  fix: [M3-7824] - ACLB TCP Rule Creation and other fixes (linode#10264)
  refactor: [M3-7687] - Linodes Restricted User Experience 2/2 (linode#10227)
  test: Resolve OBJ create and delete E2E test flake (linode#10245)
  upcoming: [M3-7723] - Placement Group feature flag as object (linode#10256)
  chore(deps): Bump sanitize-html from 2.11.0 to 2.12.1 (linode#10247)
  change: [M3-7813] - Allow the disabling of the TypeToConfirm input (linode#10251)
  upcoming: [M3-7839] - Change Business Partner to Parent User (linode#10259)
  upcoming: [M3-7835] - Adjust user table column count (linode#10252)
  upcoming: [M3 7738] - Update Placement Group Create & Edit Drawers (linode#10205)
  refactor: [M3-7437] - Use `@lukemorales/query-key-factory` for Profile Queries (linode#10241)
  fix: React Query `updateInPaginatedStore` helper function not working as expected (linode#10249)
  test: [M3-7497] - Add tests for child user verification banner (linode#10204)
  ...

# Conflicts:
#	packages/manager/src/MainContent.tsx
#	packages/manager/src/dev-tools/FeatureFlagTool.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Bug Fixes for regressions or bugs Parent / Child Account
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants