dont't fail on missing LDAP users

This commit is contained in:
Kasownik 2021-03-07 22:57:41 +01:00
parent f5343ebd08
commit bb0cc73318

View file

@ -25,6 +25,7 @@
"""An API to retrieve and set data in the Warsaw Hackerspce LDAP tree."""
import ldap
import logging
from flask import g
@ -77,6 +78,9 @@ def update_member_groups(c, changes):
for op in changes[group]:
for username in changes[group][op]:
if op == 'add':
if get_member_fields(c, username, ['uid'])['uid'] is None:
logging.warning('User %r missing from LDAP, ignoring...', username)
continue
changed = True
target_members.add(username)
elif op == 'remove':