From 56660d52f282437de12c4007cd7b8f004dc9e9cf Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 1 Oct 2020 00:09:21 +1000 Subject: [PATCH] Add "permission denied" message on modal forms --- .../InvenTree/static/script/inventree/modals.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/InvenTree/InvenTree/static/script/inventree/modals.js b/InvenTree/InvenTree/static/script/inventree/modals.js index 1cb5346a68..80ada1596f 100644 --- a/InvenTree/InvenTree/static/script/inventree/modals.js +++ b/InvenTree/InvenTree/static/script/inventree/modals.js @@ -807,7 +807,19 @@ function launchModalForm(url, options = {}) { } }, error: function (xhr, ajaxOptions, thrownError) { + $(modal).modal('hide'); + + // Permission denied! + if (xhr.status == 403) { + showAlertDialog( + "Permission Denied", + "You do not have the required permissions to access this function" + ); + + return; + } + showAlertDialog('Error requesting form data', renderErrorMessage(xhr)); } };