mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Add inaccessible_callback to BaseView
This commit is contained in:
parent
c0a4f215e8
commit
c35e2507e1
1 changed files with 8 additions and 2 deletions
|
@ -339,7 +339,13 @@ class SecureAssistantModelView(CustomModelView):
|
||||||
return super().get_details_columns()
|
return super().get_details_columns()
|
||||||
|
|
||||||
|
|
||||||
class SecureAdminBaseView(BaseView):
|
class CustomBaseView(BaseView):
|
||||||
|
def inaccessible_callback(self, name, **kwargs):
|
||||||
|
# Redirect to login page if user doesn't have access
|
||||||
|
return redirect(url_for("security.login", next=request.url))
|
||||||
|
|
||||||
|
|
||||||
|
class SecureAdminBaseView(CustomBaseView):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
url = get_url(kwargs)
|
url = get_url(kwargs)
|
||||||
super().__init__(endpoint="admin_" + url, **kwargs)
|
super().__init__(endpoint="admin_" + url, **kwargs)
|
||||||
|
@ -348,7 +354,7 @@ class SecureAdminBaseView(BaseView):
|
||||||
return adminViewIsAccessible()
|
return adminViewIsAccessible()
|
||||||
|
|
||||||
|
|
||||||
class SecureAssistantBaseView(BaseView):
|
class SecureAssistantBaseView(CustomBaseView):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
url = get_url(kwargs)
|
url = get_url(kwargs)
|
||||||
super().__init__(endpoint="assistant_" + url, **kwargs)
|
super().__init__(endpoint="assistant_" + url, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue