Module: check_mk
Branch: master
Commit: 32315c7928211d10d7def9653bd4488b16c8c5f8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=32315c7928211d…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Sep 29 18:21:45 2016 +0200
Fix implementatin of Werk #3738
The previous fix was not optimal
---
web/plugins/userdb/ldap.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index da505a1..f50c926 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -997,7 +997,7 @@ class LDAPUserConnector(UserConnector):
intersect = set_new.intersection(set_old)
added = set_new - intersect
removed = set_old - intersect
- changed = set(o for o in intersect if users[user_id][o] != user[o])
+ changed = self.find_changed_user_keys(intersect, users[user_id], user)
users[user_id] = user # Update the user record
@@ -1047,6 +1047,20 @@ class LDAPUserConnector(UserConnector):
save_users(users)
+ def find_changed_user_keys(self, keys, user, new_user):
+ changed = set([])
+ for key in keys:
+ value = user[key]
+ new_value = new_user[key]
+ if type(value) == list and type(new_value) == list:
+ is_changed = sorted(value) != sorted(new_value)
+ else:
+ is_changed = value != new_value
+ if is_changed:
+ changed.add(key)
+ return changed
+
+
def execute_active_sync_plugins(self, user_id, ldap_user, user):
for key, params in self._config['active_plugins'].items():
user.update(ldap_attribute_plugins[key]['sync_func'](self, key,
params or {}, user_id, ldap_user, user))
@@ -1308,7 +1322,7 @@ def get_groups_of_user(connection, user_id, ldap_user, cg_names,
nested, other_c
if user_cmp_val in group['members']:
group_cns.append(group['cn'])
- return sorted(group_cns)
+ return group_cns
group_membership_parameters = [