@@ -84,12 +84,7 @@ def __init__(self, caller_options):
84
84
self .groups_client = None
85
85
self .logger = logger = user_sync .connector .helper .create_logger (options )
86
86
87
- try :
88
- options ['user_identity_type' ] = user_sync .identity_type .parse_identity_type (options ['user_identity_type' ])
89
- except user_sync .error .AssertionException as e :
90
- logger .error (e .message )
91
- e .set_reported ()
92
- raise e
87
+ self .user_identity_type = user_sync .identity_type .parse_identity_type (options ['user_identity_type' ])
93
88
94
89
self .options = options
95
90
@@ -220,6 +215,17 @@ def iter_users(self, users_filter, extended_attributes):
220
215
221
216
source_attributes ['id' ] = user ['uid' ] = record .id
222
217
source_attributes ['email' ] = user ['email' ] = profile .email
218
+
219
+ source_attributes ['identity_type' ] = identity_type = self .user_identity_type
220
+ if not identity_type :
221
+ user ['identity_type' ] = self .user_identity_type
222
+ else :
223
+ try :
224
+ user ['identity_type' ] = user_sync .identity_type .parse_identity_type (identity_type )
225
+ except user_sync .error .AssertionException as e :
226
+ self .logger .warning ('Skipping user %s: %s' , profile .login , e .message )
227
+ continue
228
+
223
229
source_attributes ['login' ] = user ['username' ] = profile .login
224
230
225
231
if profile .firstName != None :
@@ -250,9 +256,6 @@ def iter_users(self, users_filter, extended_attributes):
250
256
# [TODO morr 2017-02-28]: Is the copy necessary? Could just assign I think
251
257
user ['source_attributes' ] = source_attributes .copy ()
252
258
253
- # added to fix warning message about identitytype not being set in user obj.
254
- user ['identitytype' ] = options ['user_identity_type' ]
255
-
256
259
yield (profile .login , user )
257
260
258
261
def iter_search_result (self , filter_string , attributes ):
0 commit comments