[8.x] [Fleet] Add missing privilege callout in Integrations Policies table (#195429) (#195534)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Add missing privilege callout in Integrations Policies table
(#195429)](https://github.com/elastic/kibana/pull/195429)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Cristina
Amico","email":"criamico@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-10-09T07:06:56Z","message":"[Fleet]
Add missing privilege callout in Integrations Policies table
(#195429)\n\nFixes
https://github.com/elastic/kibana/issues/191800\r\n\r\n## Summary\r\nAdd
missing privilege callout in Integrations Policies table. \r\nCurrently
the route\r\n`app/integrations/detail/{pkgName}-{version}/policies` is
available even\r\nthough the policies tab is not visible with limited
privileges.\r\n\r\n### Testing \r\n- Install `osquery_manager`\r\n-
Enable rbac feature flag\r\n- Create role with
privileges\r\n![Screenshot 2024-10-08 at 16
24\r\n46](https://github.com/user-attachments/assets/774de651-ac91-4365-9151-2df18efc811c)\r\n-
Log in with user with the above role\r\n- Navigate to
`app/integrations/detail/osquery_manager-1.14.0/policies`\r\n- Verify
that a limited privileges callout is displayed\r\n![Screenshot
2024-10-08 at 16
12\r\n23](https://github.com/user-attachments/assets/4498cbc1-243b-4fa9-a028-8899670f8e14)","sha":"c3c587bc50816ce570d442b805fe63cb8faee8cc","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","v8.16.0","backport:version"],"title":"[Fleet]
Add missing privilege callout in Integrations Policies
table","number":195429,"url":"https://github.com/elastic/kibana/pull/195429","mergeCommit":{"message":"[Fleet]
Add missing privilege callout in Integrations Policies table
(#195429)\n\nFixes
https://github.com/elastic/kibana/issues/191800\r\n\r\n## Summary\r\nAdd
missing privilege callout in Integrations Policies table. \r\nCurrently
the route\r\n`app/integrations/detail/{pkgName}-{version}/policies` is
available even\r\nthough the policies tab is not visible with limited
privileges.\r\n\r\n### Testing \r\n- Install `osquery_manager`\r\n-
Enable rbac feature flag\r\n- Create role with
privileges\r\n![Screenshot 2024-10-08 at 16
24\r\n46](https://github.com/user-attachments/assets/774de651-ac91-4365-9151-2df18efc811c)\r\n-
Log in with user with the above role\r\n- Navigate to
`app/integrations/detail/osquery_manager-1.14.0/policies`\r\n- Verify
that a limited privileges callout is displayed\r\n![Screenshot
2024-10-08 at 16
12\r\n23](https://github.com/user-attachments/assets/4498cbc1-243b-4fa9-a028-8899670f8e14)","sha":"c3c587bc50816ce570d442b805fe63cb8faee8cc"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195429","number":195429,"mergeCommit":{"message":"[Fleet]
Add missing privilege callout in Integrations Policies table
(#195429)\n\nFixes
https://github.com/elastic/kibana/issues/191800\r\n\r\n## Summary\r\nAdd
missing privilege callout in Integrations Policies table. \r\nCurrently
the route\r\n`app/integrations/detail/{pkgName}-{version}/policies` is
available even\r\nthough the policies tab is not visible with limited
privileges.\r\n\r\n### Testing \r\n- Install `osquery_manager`\r\n-
Enable rbac feature flag\r\n- Create role with
privileges\r\n![Screenshot 2024-10-08 at 16
24\r\n46](https://github.com/user-attachments/assets/774de651-ac91-4365-9151-2df18efc811c)\r\n-
Log in with user with the above role\r\n- Navigate to
`app/integrations/detail/osquery_manager-1.14.0/policies`\r\n- Verify
that a limited privileges callout is displayed\r\n![Screenshot
2024-10-08 at 16
12\r\n23](https://github.com/user-attachments/assets/4498cbc1-243b-4fa9-a028-8899670f8e14)","sha":"c3c587bc50816ce570d442b805fe63cb8faee8cc"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Cristina Amico <criamico@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2024-10-09 20:21:16 +11:00 committed by GitHub
parent 327ce6a521
commit 59c3b861a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,6 +67,8 @@ import {
import type { WithHeaderLayoutProps } from '../../../../layouts';
import { WithHeaderLayout } from '../../../../layouts';
import { PermissionsError } from '../../../../../fleet/layouts';
import { DeferredAssetsWarning } from './assets/deferred_assets_warning';
import { useIsFirstTimeAgentUserQuery } from './hooks';
import { getInstallPkgRouteOptions } from './utils';
@ -826,7 +828,14 @@ export function Detail() {
<Configs packageInfo={packageInfo} />
</Route>
<Route path={INTEGRATIONS_ROUTING_PATHS.integration_details_policies}>
<PackagePoliciesPage name={packageInfo.name} version={packageInfo.version} />
{canReadIntegrationPolicies ? (
<PackagePoliciesPage name={packageInfo.name} version={packageInfo.version} />
) : (
<PermissionsError
error="MISSING_PRIVILEGES"
requiredFleetRole="Agent Policies Read and Integrations Read"
/>
)}
</Route>
<Route path={INTEGRATIONS_ROUTING_PATHS.integration_details_custom}>
<CustomViewPage packageInfo={packageInfo} />