forked from fnux/rt2zammad
[rt2zammad] update fs2zammad for Task#12785
This commit is contained in:
parent
b5a6453acc
commit
ed45622c04
1 changed files with 7 additions and 1 deletions
|
@ -104,15 +104,21 @@ def maybe_create_zammad_user(userdata, zammad_session, attr="login", default=Non
|
||||||
first = ""
|
first = ""
|
||||||
kwargs["lastname"] = last
|
kwargs["lastname"] = last
|
||||||
kwargs["firstname"] = first
|
kwargs["firstname"] = first
|
||||||
|
#print("*kwargs",kwargs) #debug
|
||||||
try:
|
try:
|
||||||
|
#print("*try") #debug
|
||||||
user = zammad_session.user.create(kwargs)
|
user = zammad_session.user.create(kwargs)
|
||||||
USERMAP[lowercase_email] = user
|
USERMAP[lowercase_email] = user
|
||||||
|
#print("*try USERMAP") #debug
|
||||||
except:
|
except:
|
||||||
# The use probably exist already...
|
# The use probably exist already...
|
||||||
result = list(zammad.user.search(lowercase_email))
|
#print("*ecept")
|
||||||
|
result = list(zammad.user.search(f'"{lowercase_email}"'))
|
||||||
|
#print("*ecept result",result) #debug
|
||||||
if len(result) >= 1:
|
if len(result) >= 1:
|
||||||
user = next(u for u in result if u['email'] == lowercase_email)
|
user = next(u for u in result if u['email'] == lowercase_email)
|
||||||
USERMAP[lowercase_email] = user
|
USERMAP[lowercase_email] = user
|
||||||
|
#print("*except USERMAP",USERMAP) #debug
|
||||||
else:
|
else:
|
||||||
print(f"Could not create/fetch user {lowercase_email}")
|
print(f"Could not create/fetch user {lowercase_email}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue