Replace admin check with check for access (#297)

Signed-off-by: Adam Malcontenti-Wilson <adman.com@gmail.com>
This commit is contained in:
Adam Malcontenti-Wilson authored and GitHub committed 2020-05-09 18:25:34 +03:00
1 parent fb287c435c
commit e21e0b577b
9 files changed
+62 -58

No files matched your search

@@ -71,7 +71,7 @@ export class Sidebar extends React.Component<Props> {
render() {
const { toggle, isPinned, className } = this.props;
const { isClusterAdmin } = configStore;
const { isClusterAdmin, allowedResources } = configStore;
const query = namespaceStore.getContextParams();
return (
<SidebarContext.Provider value={{ pinned: isPinned }}>
@@ -91,14 +91,13 @@ export class Sidebar extends React.Component<Props> {
<div className="sidebar-nav flex column box grow-fixed">
<SidebarNavItem
id="cluster"
isHidden={!isClusterAdmin}
url={clusterURL()}
text={<Trans>Cluster</Trans>}
icon={<Icon svg="kube"/>}
/>
<SidebarNavItem
id="nodes"
isHidden={!isClusterAdmin}
isHidden={!allowedResources.includes('nodes')}
url={nodesURL()}
text={<Trans>Nodes</Trans>}
icon={<Icon svg="nodes"/>}
@@ -166,7 +165,7 @@ export class Sidebar extends React.Component<Props> {
/>
<SidebarNavItem
id="custom-resources"
isHidden={!isClusterAdmin}
isHidden={!allowedResources.includes('customresourcedefinitions')}
url={crdURL()}
subMenus={CustomResources.tabRoutes}
routePath={crdRoute.path}