mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Hide Edit button for non system admin
Hide Edit button for non system admin See: https://github.com/ansible/tower/issues/5032
This commit is contained in:
parent
1c70773cc2
commit
8d99f79de4
@ -23,7 +23,7 @@ import {
|
||||
} from '../../../../util/dates';
|
||||
|
||||
function SubscriptionDetail() {
|
||||
const { license_info, version } = useConfig();
|
||||
const { me = {}, license_info, version } = useConfig();
|
||||
const baseURL = '/settings/subscription';
|
||||
const tabsArray = [
|
||||
{
|
||||
@ -164,15 +164,17 @@ function SubscriptionDetail() {
|
||||
contact us.
|
||||
</Button>
|
||||
</Trans>
|
||||
<CardActionsRow>
|
||||
<Button
|
||||
aria-label={t`edit`}
|
||||
component={Link}
|
||||
to="/settings/subscription/edit"
|
||||
>
|
||||
<Trans>Edit</Trans>
|
||||
</Button>
|
||||
</CardActionsRow>
|
||||
{me.is_superuser && (
|
||||
<CardActionsRow>
|
||||
<Button
|
||||
aria-label={t`edit`}
|
||||
component={Link}
|
||||
to="/settings/subscription/edit"
|
||||
>
|
||||
<Trans>Edit</Trans>
|
||||
</Button>
|
||||
</CardActionsRow>
|
||||
)}
|
||||
</CardBody>
|
||||
</>
|
||||
);
|
||||
|
||||
@ -71,6 +71,14 @@ describe('<SubscriptionDetail />', () => {
|
||||
assertDetail('Hosts remaining', '1000');
|
||||
assertDetail('Hosts automated', '12 since 3/2/2021, 7:43:48 PM');
|
||||
|
||||
expect(wrapper.find('Button[aria-label="edit"]').length).toBe(0);
|
||||
});
|
||||
|
||||
test('should render edit button for system admin', () => {
|
||||
wrapper = mountWithContexts(<SubscriptionDetail />, {
|
||||
context: { ...config, me: { is_superuser: true } },
|
||||
});
|
||||
|
||||
expect(wrapper.find('Button[aria-label="edit"]').length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user