mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Replace admin check with check for access (#297)
Signed-off-by: Adam Malcontenti-Wilson <adman.com@gmail.com>
This commit is contained in:
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}
|
||||
|
||||
Reference in new issue
Block a user