mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Logs UI] Check for privileges with user management links (#91134)
* Wrap users management link with privileges check
This commit is contained in:
parent
3a05b681ae
commit
aa1f02489e
1 changed files with 11 additions and 0 deletions
|
@ -9,12 +9,23 @@ import { EuiButton, EuiButtonProps } from '@elastic/eui';
|
|||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
import { useLinkProps } from '../../../hooks/use_link_props';
|
||||
import { useKibanaContextForPlugin } from '../../../hooks/use_kibana';
|
||||
|
||||
export const UserManagementLink: React.FunctionComponent<EuiButtonProps> = (props) => {
|
||||
const {
|
||||
services: {
|
||||
application: { capabilities },
|
||||
},
|
||||
} = useKibanaContextForPlugin();
|
||||
const canAccessUserManagement = capabilities?.management?.security?.users ?? false;
|
||||
|
||||
const linkProps = useLinkProps({
|
||||
app: 'management',
|
||||
pathname: '/security/users',
|
||||
});
|
||||
|
||||
if (!canAccessUserManagement) return null;
|
||||
|
||||
return (
|
||||
<EuiButton color="primary" fill {...linkProps} {...props}>
|
||||
<FormattedMessage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue