Skip to content

Commit 7f1e440

Browse files
Merge pull request #103 from Luci2015/v2
Update functional.py - fixes #102
2 parents 2958fcd + a73a1ec commit 7f1e440

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

umapi_client/functional.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,15 @@ def __init__(self, id_type=IdentityTypes.adobeID, email=None, username=None, dom
103103
raise ArgumentError("No user identity specified.")
104104
elif not domain:
105105
raise ArgumentError("Both username and domain must be specified")
106-
107-
if username:
108-
Action.__init__(self, user=username, domain=self.domain, **kwargs)
109-
elif id_type == IdentityTypes.adobeID:
106+
107+
if id_type == IdentityTypes.adobeID:
110108
# by default if two users have the same email address, the UMAPI server will prefer the matching
111109
# Federated or Enterprise ID user; so we use the undocumented option to prefer the AdobeID match
112110
Action.__init__(self, user=email, useAdobeID=True, **kwargs)
111+
elif username and '@' in username:
112+
Action.__init__(self, user=username, **kwargs)
113+
elif username and '@' not in username:
114+
Action.__init__(self, user=username, domain=self.domain, **kwargs)
113115
else:
114116
Action.__init__(self, user=email, **kwargs)
115117

0 commit comments

Comments
 (0)