From 5ca451510fb43c6d1c0d91a55bf9b6760da38320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Wed, 8 May 2024 18:08:19 +0200 Subject: [PATCH] [fs2zammad] add exact filter on looked up user emails --- fs2zammad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs2zammad b/fs2zammad index f2e8571..3861ded 100755 --- a/fs2zammad +++ b/fs2zammad @@ -91,8 +91,8 @@ def maybe_create_zammad_user(userdata, zammad_session, attr="login", default=Non except: # The use probably exist already... result = list(zammad.user.search(lowercase_email)) - if len(result) == 1: - user = list.pop(result) + if len(result) >= 1: + user = next(u for u in result if u.email == lowercase_email) USERMAP[lowercase_email] = user else: print(f"Could not create/fetch user {lowercase_email}")