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

upcoming: [M3-7460] - Child View: Users & Grants page #10076

Merged
merged 26 commits into from
Jan 29, 2024

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented Jan 18, 2024

Description πŸ“

This PR implements the child user view of the Users & Grants page with a new table to separate out Business Partners (the proxy users by which Parent users log into their child accounts) from other users on the child account. Proxy users do not have viewable profiles or last logins, nor can they be deleted. Child users also cannot delete their own accounts.

Adjustments to the Users & Grants page, User Permissions page, and Settings page have been made to account for this.

Changes πŸ”„

  1. Create a "Business Partner Settings" table with three columns: Username, E-mail address, and Account access.
  2. Implement a "Manage Access" CTA button within the table.
  3. Ensure the inability to delete the proxy account.
  4. Ensure the absence of a "Profile" tab for the proxy user.
  5. Restrict both Proxy and Child accounts from deleting the Child Account.
  6. Updates unit test coverage for UserRow and CloseAccountSettings.
  7. Adds some of the integration test coverage outlined in M3-7500.

Additionally:

  • Updates the notice above the Close Account button for accounts with children to a tooltip
  • Fixes a misleadingly passing test in Button.test.tsx.

Preview πŸ“·

Description Image
User & Grants as viewed by a child user OR unrestricted proxy user Screenshot 2024-01-18 at 4 03 24 PM
Proxy user permissions pages don't have tabs because they don't have a User Profile page Screenshot 2024-01-18 at 4 03 34 PM
Child users cannot close their own accounts Screenshot 2024-01-19 at 10 05 25 AM
Parent users cannot close their account with existing child accounts, Proxy users should also see this message since they're the "business partners" Screenshot 2024-01-19 at 10 05 45 AM

How to test πŸ§ͺ

Prerequisites

(How to setup test environment)

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

Verification steps

(How to verify changes)

  • Go to http://localhost:3000/account/users and verify the proxy user (starting with ParentCompany) displays in a table of proxy users (known to the user as "business partners") above the table of other users on the child account.
  • Verify only the Username, Email, and Account Access fields display for a proxy user and there are no User Profile or Delete buttons.
  • Verify the different tables are labeled.
  • Verify clicking the Manage Access button for a proxy user navigates to the user's User Permissions page.
  • Go to http://localhost:3000/account/settings and verify the Close Account button is disabled with a tooltip explanation.
  • Go to serverHandlers.ts and change the active profile user_type to 'proxy'. Verify the Close Account button is disabled with a different tooltip explanation - same tooltip as is visible for parent accounts.
  • Confirm no regressions to the Users & Grants page and User Permissions pages, like no changes are visible when the feature flag is toggled off.
  • Confirm tests pass:
yarn test CloseAccountSetting UserRow Button
yarn cy:run -s "cypress/e2e/core/account/user-permissions.spec.ts"

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 force-pushed the M3-7460-child-view-users-and-grants branch from 1cfe954 to 95c468a Compare January 18, 2024 18:17
packages/manager/src/mocks/serverHandlers.ts Outdated Show resolved Hide resolved
Comment on lines 207 to 232
<Box>
{showProxyUserTable && (
<Typography
sx={(theme) => ({
marginTop: theme.spacing(3),
[theme.breakpoints.down('md')]: {
marginLeft: theme.spacing(1),
},
})}
variant="h3"
>
User settings
</Typography>
)}
<Box display="flex" justifyContent="flex-end" sx={{ marginBottom: 1 }}>
<AddNewLink
disabledReason={
isRestrictedUser
? 'You cannot create other users as a restricted user.'
: undefined
}
disabled={isRestrictedUser}
label="Add a User"
onClick={() => setIsCreateDrawerOpen(true)}
/>
</Box>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When viewing the Users & Grants page as a child user, table headers will label each table and the Add User button will be moved from the top of the page to above the User settings table to avoid implying that child users can create new proxy users. (Child users can create regular users.)

packages/manager/src/features/Users/UsersLanding.tsx Outdated Show resolved Hide resolved
expect(screen.getByRole('tooltip')).toBeInTheDocument();
});

expect(screen.getByText('Test tooltip')).toBeVisible();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We needed to wait for the tooltip to display after mousing over the button. This test was misleadingly passing because the button's name is 'Test', not because the tooltip was being displayed.

@mjac0bs mjac0bs marked this pull request as ready for review January 19, 2024 18:36
@mjac0bs mjac0bs requested a review from a team as a code owner January 19, 2024 18:36
@mjac0bs mjac0bs requested review from dwiley-akamai, abailly-akamai and jaalah-akamai and removed request for a team January 19, 2024 18:36
Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

βœ… Verified you cannot close accounts and tooltip text changes accordingly
βœ… Verified profile does not display for proxy user
βœ… Verified Account Access column for child users

@jaalah-akamai
Copy link
Contributor

Should we align the "User Settings" title with the "Add A User" button on the "Users & Grants" page?

@mjac0bs
Copy link
Contributor Author

mjac0bs commented Jan 19, 2024

Should we align the "User Settings" title with the "Add A User" button on the "Users & Grants" page?

@jaalah-akamai Yeah, that's a good thought. I was following the mocks, which have it below, but I bet it'd look better aligned. πŸ‘€

@jaalah-akamai
Copy link
Contributor

This PR looks good, I'll approve once you make the /profile updates now that #10080 is merged πŸš€ πŸŽ‰

@mjac0bs mjac0bs requested review from jdamore-linode and removed request for a team January 19, 2024 23:55
Copy link

github-actions bot commented Jan 20, 2024

Coverage Report: βœ…
Base Coverage: 81.18%
Current Coverage: 81.18%

@mjac0bs
Copy link
Contributor Author

mjac0bs commented Jan 20, 2024

Should we align the "User Settings" title with the "Add A User" button on the "Users & Grants" page?

@jaalah-akamai Yeah, that's a good thought. I was following the mocks, which have it below, but I bet it'd look better aligned. πŸ‘€

@jaalah-akamai Done in 82c7284.

Switched over to /profile for getting the user_type and updated unit tests accordingly.

I also ended up rewriting some of an e2e test for coverage of this stuff while I was there anyway to fix a failure caused by the addition of the "Manage Access" button in this PR.

@jaalah-akamai jaalah-akamai added the Add'tl Approval Needed Waiting on another approval! label Jan 22, 2024
Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

βœ…

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

UI looks great and implementation matches the description!

I left some questions/comments for code improvement

Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

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

Proxy user displays in a table of proxy users (known to the user as "business partners") above the table of other users on the child account βœ…
Only the Username, Email, and Account Access fields display for a proxy user and there are no User Profile or Delete buttons βœ…
The different tables are labeled βœ…
Clicking the Manage Access button for a proxy βœ…
The Close Account button is disabled with a tooltip explanation βœ…
Active profile user_type set to 'proxy' --> the Close Account button is disabled with the same tooltip explanation βœ…
No regressions to the Users & Grants page and User Permissions pages, like no changes are visible when the feature flag is toggled off βœ…
Tests pass βœ…

This goes beyond this PR, but the account hierarchy feels a bit confusing sometimes. For example, a proxy user can't see themselves displayed on the Users & Grants page, but the child account can

packages/manager/src/mocks/serverHandlers.ts Outdated Show resolved Hide resolved
packages/manager/src/features/Users/UsersLanding.tsx Outdated Show resolved Hide resolved
packages/manager/src/features/Users/UsersLanding.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

Nice work and thanks for addressing all the changes!

Feature looks great and confirming steps outlined in the description βœ…

Approving pending the outstanding question with the paginated table

@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Jan 25, 2024
@mjac0bs mjac0bs merged commit d11cc59 into linode:develop Jan 29, 2024
17 of 18 checks passed
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! Parent / Child Account
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants