Module: check_mk
Branch: master
Commit: 5b80629c9cb252d59b1e85d240ea6b6f94c8c0d7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5b80629c9cb252…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Sep 7 09:13:10 2015 +0200
Fixed exception when ldap connection of existing ldap users is deleted
---
web/htdocs/userdb.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index 10c171d..299cb59 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -116,19 +116,27 @@ def get_connection(connection_id):
return dict(get_connections()).get(connection_id)
-# Returns a list of locked attributes
+# Returns a list of connection specific locked attributes
def locked_attributes(connection_id):
- return get_connection(cleanup_connection_id(connection_id)).locked_attributes()
+ return get_attributes(connection_id, "locked_attributes")
-# Returns a list of multisite attributes
+# Returns a list of connection specific multisite attributes
def multisite_attributes(connection_id):
- return get_connection(cleanup_connection_id(connection_id)).multisite_attributes()
+ return get_attributes(connection_id, "multisite_attributes")
-# Returns a list of non contact attributes
+# Returns a list of connection specific non contact attributes
def non_contact_attributes(connection_id):
- return get_connection(cleanup_connection_id(connection_id)).non_contact_attributes()
+ return get_attributes(connection_id, "non_contact_attributes")
+
+
+def get_attributes(connection_id, what):
+ connection = get_connection(connection_id)
+ if connection:
+ return getattr(connection, what)()
+ else:
+ return []
def new_user_template(connection_id):