mirror of
https://github.com/logos-co/open-law.git
synced 2025-01-09 22:35:50 +00:00
17 lines
494 B
Python
17 lines
494 B
Python
from flask_admin import AdminIndexView
|
|
from flask_login import current_user
|
|
from flask import redirect, url_for
|
|
|
|
|
|
class CustomAdminIndexView(AdminIndexView):
|
|
def is_accessible(self):
|
|
return current_user.is_super_user
|
|
|
|
def is_visible(self):
|
|
# This view won't appear in the menu structure
|
|
return False
|
|
|
|
def inaccessible_callback(self, name, **kwargs):
|
|
# redirect to login page if user doesn't have access
|
|
return redirect(url_for("main.index"))
|