1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 01:14:21 +01:00

adding logs when adding a user to a group

This commit is contained in:
kakwa 2015-06-18 20:38:10 +02:00
parent b0e7df32b9
commit f821aab9f4

View File

@ -258,11 +258,20 @@ class Backend(ldapcherry.backend.Backend):
group = self._str(group)
for attr in self.group_attrs:
content = self._str(self.group_attrs[attr] % attrs)
self._logger(
severity = logging.DEBUG,
msg = "%(backend)s: adding user '%(user)s' with dn '%(dn)s' to group '%(group)s' by setting '%(attr)s' to '%(content)s'" % \
{ 'user': username, 'dn': dn, 'group': group, 'attr': attr, 'content': content, 'backend': self.backend_name }
)
ldif = modlist.modifyModlist({}, { attr : content })
try:
ldap_client.modify_s(group, ldif)
except ldap.TYPE_OR_VALUE_EXISTS as e:
pass
self._logger(
severity = logging.INFO,
msg = "%(backend)s: user '%(user)s' already member of group '%(group)s' (attribute '%(attr)s')" % \
{ 'user': username, 'group': group, 'attr': attr, 'backend': self.backend_name}
)
ldap_client.unbind_s()
def del_from_groups(self, username, groups):