mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
adding logs when adding a user to a group
This commit is contained in:
parent
b0e7df32b9
commit
f821aab9f4
@ -258,11 +258,20 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
group = self._str(group)
|
group = self._str(group)
|
||||||
for attr in self.group_attrs:
|
for attr in self.group_attrs:
|
||||||
content = self._str(self.group_attrs[attr] % 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 })
|
ldif = modlist.modifyModlist({}, { attr : content })
|
||||||
try:
|
try:
|
||||||
ldap_client.modify_s(group, ldif)
|
ldap_client.modify_s(group, ldif)
|
||||||
except ldap.TYPE_OR_VALUE_EXISTS as e:
|
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()
|
ldap_client.unbind_s()
|
||||||
|
|
||||||
def del_from_groups(self, username, groups):
|
def del_from_groups(self, username, groups):
|
||||||
|
Loading…
Reference in New Issue
Block a user