@@ -71,11 +71,22 @@ def _validate(email=None, username=None, domain=None):
71
71
def __init__ (self , id_type = IdentityTypes .adobeID , email = None , username = None , domain = None , ** kwargs ):
72
72
"""
73
73
Create an Action for a user identified either by email or by username and domain.
74
- You can specify email and username in which case the email provides the domain and is remembered
75
- for use in later commands associated with this user.
74
+ You should pretty much always use just email, unless the user has a Federated ID and his
75
+ username is different from his email. In that case you can give either username and email
76
+ (and we'll get the domain from his email) or the username and domain (in case you don't
77
+ know or don't care about the user's email).
78
+ Note that the identity type determines what you can do with this user. For example,
79
+ create will create a user of the specified identity type. Similarly, each identity type restricts
80
+ what fields can be updated. If you are specifying an existing user by email, and you are not
81
+ sure what identity type the existing user is, and you are doing something (such as add_to_groups)
82
+ that can be done with any identity type, then you can specify any type, and the type you specify
83
+ will be used to break ties if there is both an AdobeID and an EnterpriseID or FederatedID user
84
+ with that same email. Normally, we choose Enterprise ID or Federated ID *over* Adobe ID, but
85
+ if you specify the type as Adobe ID then we will act on the Adobe ID user instead.
76
86
:param id_type: IdentityTypes enum value (or the name of one), defaults to adobeID
77
- :param username: string, username in the Adobe domain (might be email)
78
- :param domain: string, required if the username is not an email address
87
+ :param email: The user's email. Typically this is also the user's username.
88
+ :param username: The username on the Adobe side. If it's the same as email, it's ignored.
89
+ :param domain: string, needed only if you specified a username but NOT an email.
79
90
:param kwargs: other key/value pairs for the action, such as requestID
80
91
"""
81
92
if str (id_type ) in IdentityTypes .__members__ :
@@ -150,8 +161,8 @@ def create(self, first_name=None, last_name=None, country=None, email=None,
150
161
return self .insert (addAdobeID = dict (email = str (email ), ** create_params ))
151
162
else :
152
163
# Federated and Enterprise allow specifying the name
153
- if first_name : create_params ["firstName " ] = str (first_name )
154
- if last_name : create_params ["lastName " ] = str (last_name )
164
+ if first_name : create_params ["firstname " ] = str (first_name )
165
+ if last_name : create_params ["lastname " ] = str (last_name )
155
166
if self .id_type == IdentityTypes .enterpriseID :
156
167
# Enterprise ID can default country, already has email on create
157
168
create_params ["country" ] = str (country ) if country else "UD"
@@ -181,7 +192,7 @@ def update(self, email=None, username=None, first_name=None, last_name=None, cou
181
192
self ._validate (email = username )
182
193
updates = {}
183
194
for k , v in six .iteritems (dict (email = email , username = username ,
184
- firstName = first_name , lastName = last_name ,
195
+ firstname = first_name , lastname = last_name ,
185
196
country = country )):
186
197
if v : updates [k ] = str (v )
187
198
return self .append (update = updates )
0 commit comments