|
27 | 27 | import user_sync.connector.umapi |
28 | 28 | import user_sync.error |
29 | 29 | import user_sync.identity_type |
| 30 | +from user_sync.connector.umapi import UmapiConnector |
30 | 31 | from user_sync.post_sync.manager import PostSyncData |
31 | 32 | from user_sync.helper import normalize_string, CSVAdapter, JobStats |
32 | 33 |
|
@@ -113,6 +114,7 @@ def __init__(self, caller_options): |
113 | 114 | self.primary_users_created = set() |
114 | 115 | self.secondary_users_created = set() |
115 | 116 | self.updated_user_keys = set() |
| 117 | + self.primary_users_by_email: dict[str, dict] = {} |
116 | 118 |
|
117 | 119 | # stray key input path comes in, stray_list_output_path goes out |
118 | 120 | self.stray_key_map = {} |
@@ -912,7 +914,7 @@ def update_umapi_user(self, umapi_info, user_key, attributes_to_update=None, gro |
912 | 914 | commands.add_groups(groups_to_add) |
913 | 915 | return commands |
914 | 916 |
|
915 | | - def update_umapi_users_for_connector(self, umapi_info, umapi_connector): |
| 917 | + def update_umapi_users_for_connector(self, umapi_info, umapi_connector: UmapiConnector): |
916 | 918 | """ |
917 | 919 | This is the main function that goes over adobe users and looks for and processes differences. |
918 | 920 | It is called with a particular organization that it should manage groups against. |
@@ -950,6 +952,9 @@ def update_umapi_users_for_connector(self, umapi_info, umapi_connector): |
950 | 952 | # Walk all the adobe users, getting their group data, matching them with directory users, |
951 | 953 | # and adjusting their attribute and group data accordingly. |
952 | 954 | for umapi_user in umapi_users: |
| 955 | + # if target is ESM, then treat existing AdobeID (i.e. businessID) as linked identity type |
| 956 | + if umapi_connector.uses_business_id and umapi_user['email'] in self.primary_users_by_email: |
| 957 | + umapi_user['type'] = self.primary_users_by_email[umapi_user['email']]['type'] |
953 | 958 | # let save adobeID users to a seperate list |
954 | 959 | self.filter_adobeID_user(umapi_user) |
955 | 960 | # get the basic data about this user; initialize change markers to "no change" |
@@ -979,6 +984,9 @@ def update_umapi_users_for_connector(self, umapi_info, umapi_connector): |
979 | 984 |
|
980 | 985 | self.map_email_override(umapi_user) |
981 | 986 |
|
| 987 | + if umapi_connector.is_primary: |
| 988 | + self.primary_users_by_email[umapi_user['email']] = umapi_user |
| 989 | + |
982 | 990 | directory_user = filtered_directory_user_by_user_key.get(user_key) |
983 | 991 | if directory_user is None: |
984 | 992 | # There's no selected directory user matching this adobe user |
|
0 commit comments