Skip to content

Commit 3f78902

Browse files
committed
Added --ignore-outcast-users feature
1 parent 01b9576 commit 3f78902

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

examples/config files - basic/user-sync-config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ invocation_defaults:
330330
adobe_users: all
331331
# For argument --connector, the default is 'ldap'.
332332
connector: ldap
333+
# For argument --ignore-outcast-users, the default is False (include all).
334+
# If you set this default to True, UST will automatically ignore user creation
335+
# on user that is not part of any group.
336+
# --include-outcast-users to override the default.
337+
ignore_outcast_users: No
333338
# For argument --process-groups, the default is False (don't process).
334339
# If you set this default to True, you can supply the argument
335340
# --no-process-groups to override the default.

user_sync/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ def main():
125125
cls=user_sync.cli.OptionMulti,
126126
type=list,
127127
metavar='ldap|okta|csv|adobe_console [path-to-file.csv]')
128+
@click.option('--ignore-outcast-users/--include-outcast-users', default=None,
129+
help='Ignore users that is not part of a group from being sync')
128130
@click.option('--process-groups/--no-process-groups', default=None,
129131
help='if membership in mapped groups differs between the enterprise directory and Adobe sides, '
130132
'the group membership is updated on the Adobe side so that the memberships in mapped '

user_sync/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class ConfigLoader(object):
5151
'config_filename': 'user-sync-config.yml',
5252
'connector': ['ldap'],
5353
'encoding_name': 'utf8',
54+
'ignore_outcast_users': False,
5455
'process_groups': False,
5556
'strategy': 'sync',
5657
'test_mode': False,

user_sync/rules.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)