You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/08/16 05:48:56 UTC
[superset] 06/34: add config to hide some user menu items (#16156)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch 1.3
in repository https://gitbox.apache.org/repos/asf/superset.git
commit a38115d5177acfc94b5eed458d6676bcc59d945a
Author: Elizabeth Thompson <es...@gmail.com>
AuthorDate: Tue Aug 10 09:03:13 2021 -0700
add config to hide some user menu items (#16156)
(cherry picked from commit 5488a8a9488a6743104095f17e66d7641da2668e)
---
superset-frontend/src/components/Menu/MenuRight.tsx | 8 +++++---
superset/config.py | 3 +++
superset/views/base.py | 6 ++++--
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/superset-frontend/src/components/Menu/MenuRight.tsx b/superset-frontend/src/components/Menu/MenuRight.tsx
index 86a4784..35d2cb0 100644
--- a/superset-frontend/src/components/Menu/MenuRight.tsx
+++ b/superset-frontend/src/components/Menu/MenuRight.tsx
@@ -136,9 +136,11 @@ const RightMenu = ({
<a href={navbarRight.user_profile_url}>{t('Profile')}</a>
</Menu.Item>
)}
- <Menu.Item key="info">
- <a href={navbarRight.user_info_url}>{t('Info')}</a>
- </Menu.Item>
+ {navbarRight.user_info_url && (
+ <Menu.Item key="info">
+ <a href={navbarRight.user_info_url}>{t('Info')}</a>
+ </Menu.Item>
+ )}
<Menu.Item key="logout">
<a href={navbarRight.user_logout_url}>{t('Logout')}</a>
</Menu.Item>
diff --git a/superset/config.py b/superset/config.py
index 6453b0c..93774da 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -1229,6 +1229,9 @@ GLOBAL_ASYNC_QUERIES_WEBSOCKET_URL = "ws://127.0.0.1:8080/"
#
DATASET_HEALTH_CHECK: Optional[Callable[["SqlaTable"], str]] = None
+# Do not show user info or profile in the menu
+MENU_HIDE_USER_INFO = False
+
# SQLalchemy link doc reference
SQLALCHEMY_DOCS_URL = "https://docs.sqlalchemy.org/en/13/core/engines.html"
SQLALCHEMY_DISPLAY_TEXT = "SQLAlchemy docs"
diff --git a/superset/views/base.py b/superset/views/base.py
index 3ad6259..a636762 100644
--- a/superset/views/base.py
+++ b/superset/views/base.py
@@ -332,11 +332,13 @@ def menu_data() -> Dict[str, Any]:
"languages": languages,
"show_language_picker": len(languages.keys()) > 1,
"user_is_anonymous": g.user.is_anonymous,
- "user_info_url": appbuilder.get_url_for_userinfo,
+ "user_info_url": None
+ if appbuilder.app.config["MENU_HIDE_USER_INFO"]
+ else appbuilder.get_url_for_userinfo,
"user_logout_url": appbuilder.get_url_for_logout,
"user_login_url": appbuilder.get_url_for_login,
"user_profile_url": None
- if g.user.is_anonymous
+ if g.user.is_anonymous or appbuilder.app.config["MENU_HIDE_USER_INFO"]
else f"/superset/profile/{g.user.username}",
"locale": session.get("locale", "en"),
},