Module: check_mk
Branch: master
Commit: 42a6cf64c55480d0d1a2f74e0228ca68f6f1cc08
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=42a6cf64c55480…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 14 10:27:32 2016 +0100
WATO roles: improved error handling when trying to edit non existing role
---
web/htdocs/wato.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 81bd746..5868515 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -10793,7 +10793,6 @@ def mode_roles(phase):
def mode_edit_role(phase):
-
role_id = html.var("edit")
if phase == "title":
@@ -10806,9 +10805,12 @@ def mode_edit_role(phase):
# Make sure that all dynamic permissions are available (e.g. those for custom
# views)
config.load_dynamic_permissions()
-
roles = userdb.load_roles()
- role = roles[role_id]
+
+ try:
+ role = roles[role_id]
+ except KeyError:
+ raise MKGeneralException(_("This role does not exist."))
if phase == "action":
alias = html.get_unicode_input("alias")