diff --git a/advlabdb/custom_classes.py b/advlabdb/custom_classes.py index fec7336..ffb9b62 100644 --- a/advlabdb/custom_classes.py +++ b/advlabdb/custom_classes.py @@ -289,7 +289,8 @@ class SecureAssistantModelView(CustomModelView): if model not in self.get_query(): reportBadAttempt("An assistant tried to change a model not in his filter!") - raise ModelViewException("Unauthorized action!") + self.handle_view_exception(ModelViewException("Unauthorized action!")) + return redirect(self.url) def on_model_delete(self, model): reportBadAttempt("An assistant tried to delete a model!") @@ -308,7 +309,8 @@ class SecureAssistantModelView(CustomModelView): if model not in self.get_query(): reportBadAttempt("An assistant tried to edit a model not in his filter!") - raise ModelViewException("Unauthorized action!") + self.handle_view_exception(ModelViewException("Unauthorized action!")) + return redirect(self.url) return super().edit_view() @@ -325,7 +327,8 @@ class SecureAssistantModelView(CustomModelView): if model not in self.get_query(): reportBadAttempt("An assistant tried to see details of a model not in his filter!") - raise ModelViewException("Unauthorized action!") + self.handle_view_exception(ModelViewException("Unauthorized action!")) + return redirect(self.url) return super().details_view()