Below code can give access to superadmin: What if I have to build another admin page for role admin which is created by superamin
class MyModelView(sqla.ModelView):
def is_accessible(self):
return (current_user.is_active and
current_user.is_authenticated and
current_user.has_role('superadmin')
)
def _handle_view(self, name, **kwargs):
if not self.is_accessible():
if current_user.is_authenticated:
abort(403)
else:
return redirect(url_for('security.login', next=request.url))
Any help or suggestion would be really appreciated!!