mirror of
https://github.com/apache/superset.git
synced 2024-09-06 22:07:34 -04:00
add config to hide some user menu items (#16156)
This commit is contained in:
parent
6e1d16d956
commit
5488a8a948
@ -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>
|
||||
|
@ -1233,6 +1233,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"
|
||||
|
@ -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"),
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user