diff --git a/configuration-example.yaml b/configuration-example.yaml index a84fd187ed26ea6d41a74199806f7a344d31d6f7..10e830feac3132c03678f0b58c0f6b2cb4bdeba8 100644 --- a/configuration-example.yaml +++ b/configuration-example.yaml @@ -10,6 +10,9 @@ sync: # completely outside of this script. ignore_google_org_unit_path_regex: '^/Service Accounts$' + # The organization unit path in which new accounts are placed + new_user_org_unit_path: '/' + # Inter-batch delay in seconds. This is useful to avoid hitting Google rate # limits. Default: 5. inter_batch_delay: 5 diff --git a/gsuitesync/sync.py b/gsuitesync/sync.py index 3cbdfb85a9d7ecacaf4ed04a5f55264088a03ecc..89e2960843f49898b16a0fedf60ac27793be8c97 100644 --- a/gsuitesync/sync.py +++ b/gsuitesync/sync.py @@ -44,6 +44,9 @@ class Configuration(config.ConfigurationDataclassMixin): # are managed completely outside of this script. ignore_google_org_unit_path_regex: typing.Union[str, None] = None + # The organization unit path in which new accounts are placed + new_user_org_unit_path: str = '/' + # Inter-batch delay in seconds. This is useful to avoid hitting Google rate limits. inter_batch_delay: numbers.Real = 5 @@ -296,6 +299,7 @@ def sync(configuration, *, read_only=True): new_user = {**{ 'hashFunction': 'crypt', 'password': crypt.crypt(secrets.token_urlsafe(), crypt.METHOD_SHA512), + 'orgUnitPath': sync_config.new_user_org_unit_path, }, **google_user_creations[uid]} redacted_user = {**new_user, **{'password': 'REDACTED'}} LOG.info('Adding user "%s": %s', uid, redacted_user) diff --git a/setup.py b/setup.py index 5be311a3d0b49298233e6ae10563453847852123..5f6dbbc3df86964603fff3abe4c75483da3db027 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ def load_requirements(): setup( name='gsuitesync', - version='0.9.0', + version='0.9.1', packages=find_packages(), install_requires=load_requirements(), entry_points={