FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 6366bf5b authored by Dr Rich Wareham's avatar Dr Rich Wareham
Browse files

Merge branch 'issue-8-set-orgunitpath' into 'master'

Set organization unit path when creating new users

Closes #8

See merge request !6
parents 25f3c97f fb0fa5bc
No related branches found
No related tags found
1 merge request!6Set organization unit path when creating new users
Pipeline #10314 passed
...@@ -10,6 +10,9 @@ sync: ...@@ -10,6 +10,9 @@ sync:
# completely outside of this script. # completely outside of this script.
ignore_google_org_unit_path_regex: '^/Service Accounts$' 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 # Inter-batch delay in seconds. This is useful to avoid hitting Google rate
# limits. Default: 5. # limits. Default: 5.
inter_batch_delay: 5 inter_batch_delay: 5
......
...@@ -44,6 +44,9 @@ class Configuration(config.ConfigurationDataclassMixin): ...@@ -44,6 +44,9 @@ class Configuration(config.ConfigurationDataclassMixin):
# are managed completely outside of this script. # are managed completely outside of this script.
ignore_google_org_unit_path_regex: typing.Union[str, None] = None 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 in seconds. This is useful to avoid hitting Google rate limits.
inter_batch_delay: numbers.Real = 5 inter_batch_delay: numbers.Real = 5
...@@ -296,6 +299,7 @@ def sync(configuration, *, read_only=True): ...@@ -296,6 +299,7 @@ def sync(configuration, *, read_only=True):
new_user = {**{ new_user = {**{
'hashFunction': 'crypt', 'hashFunction': 'crypt',
'password': crypt.crypt(secrets.token_urlsafe(), crypt.METHOD_SHA512), 'password': crypt.crypt(secrets.token_urlsafe(), crypt.METHOD_SHA512),
'orgUnitPath': sync_config.new_user_org_unit_path,
}, **google_user_creations[uid]} }, **google_user_creations[uid]}
redacted_user = {**new_user, **{'password': 'REDACTED'}} redacted_user = {**new_user, **{'password': 'REDACTED'}}
LOG.info('Adding user "%s": %s', uid, redacted_user) LOG.info('Adding user "%s": %s', uid, redacted_user)
......
...@@ -17,7 +17,7 @@ def load_requirements(): ...@@ -17,7 +17,7 @@ def load_requirements():
setup( setup(
name='gsuitesync', name='gsuitesync',
version='0.9.0', version='0.9.1',
packages=find_packages(), packages=find_packages(),
install_requires=load_requirements(), install_requires=load_requirements(),
entry_points={ entry_points={
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment