@@ -72,6 +72,7 @@ def __init__(self, caller_options):
7272 self .directory_user_by_user_key = {}
7373 self .filtered_directory_user_by_user_key = {}
7474 self .umapi_info_by_name = {}
75+ self .adobeid_user_by_email = {}
7576 # counters for action summary log
7677 self .action_summary = {
7778 # these are in alphabetical order! Always add new ones that way!
@@ -489,8 +490,6 @@ def sync_umapi_users(self, umapi_connectors):
489490 # If user is not part of any group and ignore outcast is enabled. Do not create user.
490491 continue
491492 # We always create every user in the primary umapi, because it's believed to own the directories.
492- self .logger .info ('Creating user with user key: %s' , user_key )
493- self .primary_users_created .add (user_key )
494493 self .create_umapi_user (user_key , groups_to_add , umapi_info , umapi_connector )
495494
496495 # then sync the secondary connectors
@@ -506,8 +505,6 @@ def sync_umapi_users(self, umapi_connectors):
506505 for user_key , groups_to_add in six .iteritems (secondary_adds_by_user_key ):
507506 # We only create users who have group mappings in the secondary umapi
508507 if groups_to_add :
509- self .logger .info ('Adding user to umapi %s with user key: %s' , umapi_name , user_key )
510- self .secondary_users_created .add (user_key )
511508 if user_key not in self .primary_users_created :
512509 # We pushed an existing user to a secondary in order to update his groups
513510 self .updated_user_keys .add (user_key )
@@ -719,6 +716,15 @@ def create_umapi_commands_for_directory_user(self, directory_user, do_update=Fal
719716 """
720717 identity_type = self .get_identity_type_from_directory_user (directory_user )
721718 update_username = None
719+
720+ # check to see if AdobeID exist for FederatedID/EnterpriseID user. Skip user if same email exist.
721+ if ((identity_type == user_sync .identity_type .FEDERATED_IDENTITY_TYPE or
722+ identity_type == user_sync .identity_type .ENTERPRISE_IDENTITY_TYPE ) and
723+ self .is_adobeID_email_exist (directory_user ['email' ])):
724+ self .logger .warning ("Skipping user creation for: %s - AdobeID already exists with %s" ,
725+ self .get_directory_user_key (directory_user ), directory_user ['email' ])
726+ return None
727+
722728 if (identity_type == user_sync .identity_type .FEDERATED_IDENTITY_TYPE and directory_user ['username' ] and
723729 '@' in directory_user ['username' ] and
724730 normalize_string (directory_user ['email' ]) != normalize_string (directory_user ['username' ])):
@@ -777,6 +783,12 @@ def create_umapi_user(self, user_key, groups_to_add, umapi_info, umapi_connector
777783 groups_to_remove = umapi_info .get_mapped_groups () - groups_to_add
778784 commands .remove_groups (groups_to_remove )
779785 commands .add_groups (groups_to_add )
786+ if umapi_connector .trusted :
787+ self .logger .info ('Adding user to umapi %s with user key: %s' , umapi_connector .name , user_key )
788+ self .secondary_users_created .add (user_key )
789+ else :
790+ self .logger .info ('Creating user with user key: %s' , user_key )
791+ self .primary_users_created .add (user_key )
780792 post_sync_user = {
781793 'type' : directory_user ['identity_type' ],
782794 'username' : directory_user ['username' ],
@@ -880,6 +892,8 @@ def update_umapi_users_for_connector(self, umapi_info, umapi_connector):
880892 # Walk all the adobe users, getting their group data, matching them with directory users,
881893 # and adjusting their attribute and group data accordingly.
882894 for umapi_user in umapi_users :
895+ # let save adobeID users to a seperate list
896+ self .filter_adobeID_user (umapi_user )
883897 # get the basic data about this user; initialize change markers to "no change"
884898 user_key = self .get_umapi_user_key (umapi_user )
885899 if not user_key :
@@ -984,6 +998,14 @@ def is_umapi_user_excluded(self, in_primary_org, user_key, current_groups):
984998 # doesn't match an included user from the primary umapi
985999 return user_key not in self .included_user_keys
9861000
1001+ def filter_adobeID_user (self , umapi_user ):
1002+ id_type = self .get_identity_type_from_umapi_user (umapi_user )
1003+ if id_type == user_sync .identity_type .ADOBEID_IDENTITY_TYPE :
1004+ self .adobeid_user_by_email [normalize_string (umapi_user ['email' ])] = umapi_user
1005+
1006+ def is_adobeID_email_exist (self , email ):
1007+ return bool (self .adobeid_user_by_email .get (normalize_string (email )))
1008+
9871009 @staticmethod
9881010 def normalize_groups (group_names ):
9891011 """
0 commit comments