Skip to content

Commit 57d9c0c

Browse files
Merge pull request #17 from bhunut-adobe/okta
Updated identitytype to identity_type
2 parents 6025912 + b03462a commit 57d9c0c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

user_sync/connector/directory_okta.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,7 @@ def __init__(self, caller_options):
8484
self.groups_client = None
8585
self.logger = logger = user_sync.connector.helper.create_logger(options)
8686

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'])
9388

9489
self.options = options
9590

@@ -220,6 +215,17 @@ def iter_users(self, users_filter, extended_attributes):
220215

221216
source_attributes['id'] = user['uid'] = record.id
222217
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+
223229
source_attributes['login'] = user['username'] = profile.login
224230

225231
if profile.firstName != None:
@@ -250,9 +256,6 @@ def iter_users(self, users_filter, extended_attributes):
250256
# [TODO morr 2017-02-28]: Is the copy necessary? Could just assign I think
251257
user['source_attributes'] = source_attributes.copy()
252258

253-
# added to fix warning message about identitytype not being set in user obj.
254-
user['identitytype'] = options['user_identity_type']
255-
256259
yield (profile.login, user)
257260

258261
def iter_search_result(self, filter_string, attributes):

0 commit comments

Comments
 (0)