Skip to content

Commit

Permalink
upcoming: [M3-7839] - Change Business Partner to Parent User (#10259)
Browse files Browse the repository at this point in the history
Co-authored-by: Jaalah Ramos <jaalah.ramos@gmail.com>
Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
Co-authored-by: mjac0bs <mjacobs@akamai.com>
  • Loading branch information
4 people authored Mar 6, 2024
1 parent 2243adf commit f8ce5e6
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Change Business Partner to Parent User ([#10259](https://github.com/linode/manager/pull/10259))
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from 'support/intercepts/feature-flags';
import { mockGetProfile } from 'support/intercepts/profile';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { PARENT_USER } from 'src/features/Account/constants';

describe('Account login history', () => {
/*
Expand Down Expand Up @@ -130,7 +131,7 @@ describe('Account login history', () => {
cy.findByLabelText('Account Logins').should('not.exist');

cy.findByText(
"You don't have permissions to edit this Account. Please contact your business partner to request the necessary permissions."
`You don't have permissions to edit this Account. Please contact your ${PARENT_USER} to request the necessary permissions.`
);
});

Expand Down
19 changes: 11 additions & 8 deletions packages/manager/cypress/e2e/core/account/user-permissions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { ui } from 'support/ui';
import { shuffleArray } from 'support/util/arrays';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { randomLabel } from 'support/util/random';
import { PARENT_USER } from 'src/features/Account/constants';

// Message shown when user has unrestricted account acess.
const unrestrictedAccessMessage =
Expand Down Expand Up @@ -561,8 +562,8 @@ describe('User permission management', () => {

/**
* Confirm the Users & Grants and User Permissions pages flow for a child account viewing a proxy user.
* Confirm that "Business partner settings" and "User settings" sections are present on the Users & Grants page.
* Confirm that proxy accounts are listed under "Business partner settings".
* Confirm that "Parent User Settings" and "User Settings" sections are present on the Users & Grants page.
* Confirm that proxy accounts are listed under "Parent User Settings".
* Confirm that clicking the "Manage Access" button navigates to the proxy user's User Permissions page at /account/users/:user/permissions.
* Confirm that no "Profile" tab is present on the proxy user's User Permissions page.
* Confirm that proxy accounts default to "Read Write" Billing Access and have disabled "Read Only" and "None" options.
Expand Down Expand Up @@ -601,14 +602,14 @@ describe('User permission management', () => {
mockGetUser(mockRestrictedProxyUser);
mockGetUserGrants(mockRestrictedProxyUser.username, mockUserGrants);

// Navigate to Users & Grants page and confirm "Business partner settings" and "User settings" sections are visible.
// Navigate to Users & Grants page and confirm "Parent User Settings" and "User Settings" sections are visible.
cy.visitWithLogin('/account/users');
cy.wait('@getUsers');
cy.findByText('Business partner settings').should('be.visible');
cy.findByText('User settings').should('be.visible');
cy.findByText(`${PARENT_USER} Settings`).should('be.visible');
cy.findByText('User Settings').should('be.visible');

// Find mock restricted proxy user under "Business partner settings", click its "Manage Access" button.
cy.findByLabelText('List of Business Partners')
// Find mock restricted proxy user under "Parent User Settings", click its "Manage Access" button.
cy.findByLabelText('List of Parent Users')
.should('be.visible')
.within(() => {
cy.findByText(mockRestrictedProxyUser.username)
Expand All @@ -630,7 +631,9 @@ describe('User permission management', () => {
);
cy.wait(['@getClientStream', '@getFeatureFlags']);

cy.findByText('Business Partner Permissions').should('be.visible');
cy.findByText('Parent User Permissions', { exact: false }).should(
'be.visible'
);

// Confirm that no "Profile" tab is present on the proxy user's User Permissions page.
expect(cy.findByText('User Profile').should('not.exist'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { randomString } from 'support/util/random';
import { ui } from 'support/ui';
import { mockUpdateProfile } from 'support/intercepts/profile';
import { PARENT_USER } from 'src/features/Account/constants';

describe('User Profile', () => {
/*
Expand Down Expand Up @@ -276,7 +277,7 @@ describe('User Profile', () => {
.trigger('mouseover');
// Click the button first, then confirm the tooltip is shown.
ui.tooltip
.findByText('You can\u{2019}t delete a business partner user.')
.findByText(`You can\u{2019}t delete a ${PARENT_USER}.`)
.should('be.visible');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('User verification banner', () => {
mockGetUserGrants(mockRestrictedProxyUser.username, mockUserGrants);
mockGetSecurityQuestions(mockSecurityQuestions).as('getSecurityQuestions');

// Navigate to Users & Grants page and confirm "Business partner settings" and "User settings" sections are visible.
// Navigate to Users & Grants page and confirm "Partner user settings" and "User settings" sections are visible.
cy.visitWithLogin('/account/users');
cy.wait(['@getUsers', '@getSecurityQuestions']);

Expand Down
9 changes: 3 additions & 6 deletions packages/manager/src/features/Account/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const BUSINESS_PARTNER = 'business partner';
export const PARENT_USER = 'parent user';
export const ADMINISTRATOR = 'account administrator';

export const grantTypeMap = {
Expand All @@ -17,12 +17,9 @@ export const grantTypeMap = {

export const PARENT_PROXY_USER_CLOSE_ACCOUNT_TOOLTIP_TEXT =
'Remove indirect customers before closing the account.';
export const CHILD_USER_CLOSE_ACCOUNT_TOOLTIP_TEXT =
'Contact your business partner to close your account.';
export const CHILD_USER_CLOSE_ACCOUNT_TOOLTIP_TEXT = `Contact your ${PARENT_USER} to close your account.`;

// TODO: Parent/Child: Requires updated copy...
export const PARENT_SESSION_EXPIRED =
'Session expired. Please log in again to your business partner account.';
export const PARENT_SESSION_EXPIRED = `Session expired. Please log in again to your ${PARENT_USER} account.`;

export const RESTRICTED_FIELD_TOOLTIP =
'This account type cannot update this field.';
4 changes: 2 additions & 2 deletions packages/manager/src/features/Account/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getStorage, setStorage } from 'src/utilities/storage';

import { ADMINISTRATOR, BUSINESS_PARTNER } from './constants';
import { ADMINISTRATOR, PARENT_USER } from './constants';

import type { GlobalGrantTypes, GrantLevel, Token } from '@linode/api-v4';
import type { GrantTypeMap } from 'src/features/Account/types';
Expand Down Expand Up @@ -55,7 +55,7 @@ export const getRestrictedResourceText = ({
? 'this ' + resourceType.replace(/s$/, '')
: resourceType;

const contactPerson = isChildUser ? BUSINESS_PARTNER : ADMINISTRATOR;
const contactPerson = isChildUser ? PARENT_USER : ADMINISTRATOR;

let message = `You don't have permissions to ${action} ${resource}.`;

Expand Down
14 changes: 10 additions & 4 deletions packages/manager/src/features/Users/UserPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {
import { APIError } from '@linode/api-v4/lib/types';
import { Paper } from '@mui/material';
import Grid from '@mui/material/Unstable_Grid2';
import { QueryClient } from '@tanstack/react-query';
import { WithSnackbarProps, withSnackbar } from 'notistack';
import { compose, flatten, lensPath, omit, set } from 'ramda';
import * as React from 'react';
import { QueryClient } from '@tanstack/react-query';
import { compose as recompose } from 'recompose';

import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel';
Expand All @@ -41,7 +41,7 @@ import {
WithQueryClientProps,
withQueryClient,
} from 'src/containers/withQueryClient.container';
import { grantTypeMap } from 'src/features/Account/constants';
import { PARENT_USER, grantTypeMap } from 'src/features/Account/constants';
import { getAPIErrorOrDefault } from 'src/utilities/errorUtils';
import { getAPIErrorFor } from 'src/utilities/getAPIErrorFor';
import { scrollErrorIntoView } from 'src/utilities/scrollErrorIntoView';
Expand Down Expand Up @@ -436,8 +436,14 @@ class UserPermissions extends React.Component<CombinedProps, State> {
sx={{ margin: 0, width: 'auto' }}
>
<StyledHeaderGrid>
<Typography data-qa-restrict-access={restricted} variant="h2">
{isProxyUser ? 'Business Partner' : 'General'} Permissions
<Typography
sx={{
textTransform: 'capitalize',
}}
data-qa-restrict-access={restricted}
variant="h2"
>
{isProxyUser ? PARENT_USER : 'General'} Permissions
</Typography>
</StyledHeaderGrid>
<StyledSubHeaderGrid>
Expand Down
4 changes: 2 additions & 2 deletions packages/manager/src/features/Users/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { useAccountUser } from 'src/queries/accountUsers';
import { useProfile } from 'src/queries/profile';
import { getAPIErrorFor } from 'src/utilities/getAPIErrorFor';

import { PARENT_USER, RESTRICTED_FIELD_TOOLTIP } from '../Account/constants';
import { UserDeleteConfirmationDialog } from './UserDeleteConfirmationDialog';
import { StyledTitle, StyledWrapper } from './UserProfile.styles';
import { RESTRICTED_FIELD_TOOLTIP } from '../Account/constants';

interface UserProfileProps {
accountErrors?: APIError[];
Expand Down Expand Up @@ -199,7 +199,7 @@ export const UserProfile = (props: UserProfileProps) => {
profile?.username === originalUsername
? 'You can\u{2019}t delete the currently active user.'
: isProxyUserProfile
? 'You can\u{2019}t delete a business partner user.'
? `You can\u{2019}t delete a ${PARENT_USER}.`
: undefined
}
buttonType="outlined"
Expand Down
8 changes: 5 additions & 3 deletions packages/manager/src/features/Users/UsersLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { PaginationFooter } from 'src/components/PaginationFooter/PaginationFoot
import { Table } from 'src/components/Table';
import { TableBody } from 'src/components/TableBody';
import { Typography } from 'src/components/Typography';
import { PARENT_USER } from 'src/features/Account/constants';
import { useFlags } from 'src/hooks/useFlags';
import { useOrder } from 'src/hooks/useOrder';
import { usePagination } from 'src/hooks/usePagination';
Expand Down Expand Up @@ -97,17 +98,18 @@ export const UsersLanding = () => {
sx={(theme) => ({
marginBottom: theme.spacing(2),
marginTop: theme.spacing(3),
textTransform: 'capitalize',
[theme.breakpoints.down('md')]: {
marginLeft: theme.spacing(1),
},
})}
variant="h3"
>
Business partner settings
{PARENT_USER} Settings
</Typography>
)}
{showProxyUserTable && (
<Table aria-label="List of Business Partners">
<Table aria-label="List of Parent Users">
<UsersLandingProxyTableHead order={order} />
<TableBody>
<UsersLandingTableBody
Expand Down Expand Up @@ -138,7 +140,7 @@ export const UsersLanding = () => {
})}
variant="h3"
>
User settings
User Settings
</Typography>
)}
<AddNewLink
Expand Down

0 comments on commit f8ce5e6

Please sign in to comment.