FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects

Set organization unit path when creating new users

Merged Robin Goodall requested to merge issue-8-set-orgunitpath into master
1 unresolved thread
3 files
+ 8
1
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 4
0
@@ -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)
Loading