From aa1cf6033a7f9f7f2daff3775dcf2e18d943a242 Mon Sep 17 00:00:00 2001 From: Nikolai R Kristiansen Date: Mon, 16 Mar 2015 00:02:28 +0100 Subject: [PATCH] minor sync fixes --- .../management/commands/sync_active_to_ldap.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/neuf_userinfo/management/commands/sync_active_to_ldap.py b/neuf_userinfo/management/commands/sync_active_to_ldap.py index 2d488f2..093ff99 100644 --- a/neuf_userinfo/management/commands/sync_active_to_ldap.py +++ b/neuf_userinfo/management/commands/sync_active_to_ldap.py @@ -119,17 +119,18 @@ class Command(BaseCommand): if self.COUNTS['create'] != 0: self.stdout.write('{} Inside users not found in LDAP'.format(self.COUNTS['create'])) if self.COUNTS['update'] != 0: - self.stdout.write('{} LDAP users were were update with info '.format(self.COUNTS['update'])) + self.stdout.write('{} LDAP users were updated with new details'.format(self.COUNTS['update'])) if int(self.options['verbosity']) >= 2: self.stdout.write('{} Inside users in sync with LDAP users '.format(self.COUNTS['in_sync'])) def user_details_in_sync(self, inside_user, ldap_user): for attr in self.DIFF_ATTRIBUTES: - if inside_user[attr] != ldap_user[attr]: - # Groups are lists - if type(attr) != list: + if attr == 'groups': + # Compare set of group names + if set(inside_user[attr]) != set(ldap_user[attr]): return False - elif set(inside_user[attr]) != set(ldap_user[attr]): + else: + if inside_user[attr] != ldap_user[attr]: return False return True \ No newline at end of file