Skip to content

Commit

Permalink
Merge pull request #4 from oarepo/mirekys/add-auth-guards
Browse files Browse the repository at this point in the history
Add authentication guard on flask_menu entry
  • Loading branch information
mirekys authored Apr 2, 2024
2 parents 10b13aa + d4cc84d commit c4891d4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"conventionalCommits.scopes": [
"release"
]
}
4 changes: 4 additions & 0 deletions oarepo_dashboard/ui/dashboard_records/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 _


Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
readme = README.md
Expand Down

0 comments on commit c4891d4

Please sign in to comment.