From d4cc84dfc3dac75eedbe3d931d87188ed34dbd12 Mon Sep 17 00:00:00 2001 From: Miroslav Bauer Date: Tue, 2 Apr 2024 10:09:05 +0200 Subject: [PATCH] chore(release): :bookmark: add authentication guard on flask_menu entry --- .vscode/settings.json | 5 +++++ oarepo_dashboard/ui/dashboard_records/__init__.py | 4 ++++ setup.cfg | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..098faaa --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "conventionalCommits.scopes": [ + "release" + ] +} \ No newline at end of file diff --git a/oarepo_dashboard/ui/dashboard_records/__init__.py b/oarepo_dashboard/ui/dashboard_records/__init__.py index c23f33a..f2ece49 100644 --- a/oarepo_dashboard/ui/dashboard_records/__init__.py +++ b/oarepo_dashboard/ui/dashboard_records/__init__.py @@ -3,6 +3,7 @@ ) from oarepo_ui.resources.resource import RecordsUIResource from flask_menu import current_menu +from flask_login import current_user from oarepo_runtime.i18n import lazy_gettext as _ @@ -40,6 +41,9 @@ def create_blueprint(app): @app_blueprint.before_app_first_request def init_menu(): + if not current_user.is_authenticated: + return + user_dashboard = current_menu.submenu("user_dashboard") user_dashboard.submenu("records").register( "records_dashboard.search", diff --git a/setup.cfg b/setup.cfg index 4af1059..5f77103 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = oarepo-dashboard -version = 1.0.1 +version = 1.0.2 description = Support for user dashboard (records, communities, requests) authors = Mirek Simek readme = README.md