1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00
AdvLabDB/advlabdb/customClasses.py

25 lines
588 B
Python
Raw Normal View History

from flask_admin import AdminIndexView
from flask_admin.contrib.sqla import ModelView
2021-06-02 21:43:41 +00:00
from flask_security import current_user
def adminViewIsAccessible():
return current_user.has_role("admin")
class SecureAdminIndexView(AdminIndexView):
def is_accessible(self):
return adminViewIsAccessible()
class SecureModelView(ModelView):
can_export = True
2021-04-24 12:01:14 +00:00
can_set_page_size = True
2021-05-17 19:34:49 +00:00
list_template = "admin_list.html"
create_template = "admin_create.html"
edit_template = "admin_edit.html"
def is_accessible(self):
return adminViewIsAccessible()