Remove violation log link from subaccounts

Subaccounts can't access the violation log so they shouldn't show
the button to see them.

Test Plan:
  - Enable CSP feature flag in Canvas
  - Go to /accounts/XX/settings and click on the security
    tab
  - You should see View Violation Log option
  - Go to a subaccount (creating one if needed)
  - Go to the settings for that subaccount and go to the
    security tab
  - You should not see the View Violation Log option

closes USERS-150

flag = javascript_csp

Change-Id: Icd837bd0b516fe92b4eb309f97b0b3fcfadba30e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/218335
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Steve Shepherd <sshepherd@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
This commit is contained in:
Clay Diffrient 2019-11-22 10:39:53 -07:00
parent 06d8c5cd5a
commit 4560458cf7
2 changed files with 17 additions and 5 deletions

View File

@ -156,11 +156,13 @@ export class Whitelist extends Component {
})}
</Heading>
</Flex.Item>
{!this.props.isSubAccount && (
<Flex.Item>
<Button variant="link" onClick={() => this.setState({showViolationTray: true})}>
{I18n.t('View Violation Log')}
</Button>
</Flex.Item>
)}
</Flex>
</View>

View File

@ -375,4 +375,14 @@ describe('ConnectedWhitelist', () => {
expect(button).toBeDisabled()
})
})
describe('isSubAccount', () => {
it('does not show the option to view a violation log', () => {
const {queryByText} = renderWithRedux(
<ConnectedWhitelist context="account" contextId="1" maxDomains={50} isSubAccount />
)
const violationLogBtn = queryByText('View Violation Log')
expect(violationLogBtn).toBeNull()
})
})
})