Unverified Commit c96258e1 authored by Jürgen Gmach's avatar Jürgen Gmach Committed by GitHub

Simplify example code

As has_role returns a boolean anyway, there is no need for another if-statement.
parent 0c4d2c9f
......@@ -54,15 +54,10 @@ security = Security(app, user_datastore)
# Create customized model view class
class MyModelView(sqla.ModelView):
def is_accessible(self):
if not current_user.is_active or not current_user.is_authenticated:
return False
if current_user.has_role('superuser'):
return True
return False
return current_user.has_role('superuser')
def _handle_view(self, name, **kwargs):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment