From 4a0a453236744a28403b06fce953ab0e5abb35b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 27 May 2019 13:19:16 +0200 Subject: [PATCH] Properly handle uppercase emails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- rt2zammad.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rt2zammad.py b/rt2zammad.py index d03de08..8574b9a 100755 --- a/rt2zammad.py +++ b/rt2zammad.py @@ -137,12 +137,13 @@ for user in target.user.all(): def get_user(userdata): email = userdata["EmailAddress"] + lemail = email.lower() # Search existing users - if email not in USERMAP: + if lemail not in USERMAP: for user in target.user.search({"query": email}): USERMAP[user["email"].lower()] = user["login"] # Create new one - if email not in USERMAP: + if lemail not in USERMAP: kwargs = {"email": email} if "RealName" in userdata: realname = userdata["RealName"] @@ -158,7 +159,7 @@ def get_user(userdata): user = target.user.create(kwargs) USERMAP[user["email"].lower()] = user["login"] - return USERMAP[email.lower()] + return USERMAP[lemail] # Create tickets