mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-29 11:26:05 +00:00
fix(ui): hide elasticSearchIndex page for non-admins (#9077)
* fix(ui): hide elasticSearchIndex page for non-admins * address comments * remove unwanted field from children
This commit is contained in:
parent
1bddfefbcd
commit
0973acc77f
@ -18,6 +18,7 @@ import React, { useMemo } from 'react';
|
|||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
import { GlobalSettingOptions } from '../../constants/GlobalSettings.constants';
|
import { GlobalSettingOptions } from '../../constants/GlobalSettings.constants';
|
||||||
import { TeamType } from '../../generated/entity/teams/team';
|
import { TeamType } from '../../generated/entity/teams/team';
|
||||||
|
import { useAuth } from '../../hooks/authHooks';
|
||||||
import {
|
import {
|
||||||
getGlobalSettingMenuItem,
|
getGlobalSettingMenuItem,
|
||||||
getGlobalSettingsMenuWithPermission,
|
getGlobalSettingsMenuWithPermission,
|
||||||
@ -34,9 +35,11 @@ const GlobalSettingLeftPanel = () => {
|
|||||||
|
|
||||||
const { permissions } = usePermissionProvider();
|
const { permissions } = usePermissionProvider();
|
||||||
|
|
||||||
|
const { isAdminUser } = useAuth();
|
||||||
|
|
||||||
const menuItems: ItemType[] = useMemo(
|
const menuItems: ItemType[] = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getGlobalSettingsMenuWithPermission(permissions).reduce(
|
getGlobalSettingsMenuWithPermission(permissions, isAdminUser).reduce(
|
||||||
(acc: ItemType[], curr: MenuList) => {
|
(acc: ItemType[], curr: MenuList) => {
|
||||||
const menuItem = getGlobalSettingMenuItem(
|
const menuItem = getGlobalSettingMenuItem(
|
||||||
curr.category,
|
curr.category,
|
||||||
|
@ -234,10 +234,7 @@ const GlobalSettingRouter = () => {
|
|||||||
<AdminProtectedRoute
|
<AdminProtectedRoute
|
||||||
exact
|
exact
|
||||||
component={ElasticSearchIndexPage}
|
component={ElasticSearchIndexPage}
|
||||||
hasPermission={userPermissions.hasViewPermissions(
|
hasPermission={false}
|
||||||
ResourceEntity.ALL,
|
|
||||||
permissions
|
|
||||||
)}
|
|
||||||
path={getSettingPath(
|
path={getSettingPath(
|
||||||
GlobalSettingsMenuCategory.EVENT_PUBLISHERS,
|
GlobalSettingsMenuCategory.EVENT_PUBLISHERS,
|
||||||
GlobalSettingOptions.ELASTIC_SEARCH
|
GlobalSettingOptions.ELASTIC_SEARCH
|
||||||
|
@ -48,7 +48,8 @@ export interface MenuList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const getGlobalSettingsMenuWithPermission = (
|
export const getGlobalSettingsMenuWithPermission = (
|
||||||
permissions: UIPermission
|
permissions: UIPermission,
|
||||||
|
isAdminUser: boolean | undefined
|
||||||
) => {
|
) => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -218,10 +219,7 @@ export const getGlobalSettingsMenuWithPermission = (
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
label: 'Elasticsearch',
|
label: 'Elasticsearch',
|
||||||
isProtected: userPermissions.hasViewPermissions(
|
isProtected: Boolean(isAdminUser),
|
||||||
ResourceEntity.ALL,
|
|
||||||
permissions
|
|
||||||
),
|
|
||||||
icon: (
|
icon: (
|
||||||
<ElasticSearchIcon className="tw-w-4 tw-mt-1.5 side-panel-icons" />
|
<ElasticSearchIcon className="tw-w-4 tw-mt-1.5 side-panel-icons" />
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user