@@ -325,6 +325,9 @@ def will_update_user_info(self, umapi_info):
325325 def will_process_groups (self ):
326326 return self .options ['process_groups' ]
327327
328+ def will_exclude_outcast_users (self ):
329+ return self .options ['ignore_outcast_users' ]
330+
328331 def get_umapi_info (self , umapi_name ):
329332 umapi_info = self .umapi_info_by_name .get (umapi_name )
330333 if umapi_info is None :
@@ -465,6 +468,7 @@ def sync_umapi_users(self, umapi_connectors):
465468 verb = "Push"
466469 else :
467470 verb = "Sync"
471+ ignore_outcast_users = self .will_exclude_outcast_users ()
468472 # first sync the primary connector, so the users get created in the primary
469473 if umapi_connectors .get_secondary_connectors ():
470474 self .logger .debug ('%sing users to primary umapi...' , verb )
@@ -476,10 +480,14 @@ def sync_umapi_users(self, umapi_connectors):
476480 else :
477481 primary_adds_by_user_key = self .update_umapi_users_for_connector (umapi_info , umapi_connector )
478482 for user_key , groups_to_add in six .iteritems (primary_adds_by_user_key ):
479- # We always create every user in the primary umapi, because it's believed to own the directories.
480- self .logger .info ('Creating user with user key: %s' , user_key )
481- self .primary_users_created .add (user_key )
482- self .create_umapi_user (user_key , groups_to_add , umapi_info , umapi_connector )
483+ if ignore_outcast_users == True and not groups_to_add :
484+ # If user is not part of any group and ignore outcast is enabled. Do not create user.
485+ pass
486+ else :
487+ # We always create every user in the primary umapi, because it's believed to own the directories.
488+ self .logger .info ('Creating user with user key: %s' , user_key )
489+ self .primary_users_created .add (user_key )
490+ self .create_umapi_user (user_key , groups_to_add , umapi_info , umapi_connector )
483491
484492 # then sync the secondary connectors
485493 for umapi_name , umapi_connector in six .iteritems (umapi_connectors .get_secondary_connectors ()):
0 commit comments