Skip to content

Commit 79a201f

Browse files
refactor
1 parent 605d496 commit 79a201f

File tree

1 file changed

+14
-8
lines changed
  • metadata-ingestion/src/datahub/ingestion/source/identity

1 file changed

+14
-8
lines changed

metadata-ingestion/src/datahub/ingestion/source/identity/okta.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -666,13 +666,12 @@ def _map_okta_user_profile_to_username(
666666
self.config.okta_profile_to_username_regex,
667667
)
668668

669-
# Converts Okta User Profile into a CorpUserInfo.
670-
def _map_okta_user_profile(self, profile: UserProfile) -> CorpUserInfoClass:
671-
# TODO: Extract user's manager if provided.
672-
# Source: https://developer.okta.com/docs/reference/api/users/#default-profile-properties
673-
full_name = f"{profile.firstName} {profile.lastName}"
674-
custom_properties = {
675-
k: v
669+
def _map_okta_user_profile_custom_properties(
670+
self, profile: UserProfile
671+
) -> Dict[str, str]:
672+
# filter out the common fields that are already mapped to the CorpUserInfo aspect and the private ones
673+
return {
674+
k: str(v)
676675
for k, v in profile.__dict__.items()
677676
if v
678677
and k
@@ -685,7 +684,14 @@ def _map_okta_user_profile(self, profile: UserProfile) -> CorpUserInfoClass:
685684
"countryCode",
686685
"department",
687686
]
687+
and not k.startswith("_")
688688
}
689+
690+
# Converts Okta User Profile into a CorpUserInfo.
691+
def _map_okta_user_profile(self, profile: UserProfile) -> CorpUserInfoClass:
692+
# TODO: Extract user's manager if provided.
693+
# Source: https://developer.okta.com/docs/reference/api/users/#default-profile-properties
694+
full_name = f"{profile.firstName} {profile.lastName}"
689695
return CorpUserInfoClass(
690696
active=True,
691697
displayName=(
@@ -698,7 +704,7 @@ def _map_okta_user_profile(self, profile: UserProfile) -> CorpUserInfoClass:
698704
title=profile.title,
699705
countryCode=profile.countryCode,
700706
departmentName=profile.department,
701-
customProperties=custom_properties,
707+
customProperties=self._map_okta_user_profile_custom_properties(profile),
702708
)
703709

704710
def _make_corp_group_urn(self, name: str) -> str:

0 commit comments

Comments
 (0)