Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new flag to auto lowercase exported user output #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dbclient/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ def get_export_parser():
parser.add_argument('--users', action='store_true',
help='Download all the users and groups in the workspace')

# convert all users to lowercase for SCIM API changes
parser.add_argument('--replace-email-auto', action='store_true',
help='Modify exported user and related configuration with a lower case username, use after export and reference with --session $SESSION')

# log all user workspace paths
parser.add_argument('--workspace', action='store_true',
help='Log all the notebook paths in the workspace. (metadata only)')
Expand Down
15 changes: 15 additions & 0 deletions export_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,21 @@ def main():
end = timer()
print("Complete email update time: " + str(timedelta(seconds=end - start)))

if args.replace_email_auto:
print("Automatically updating old email to new email address at {0}".format(now))
start = timer()
client = dbclient(client_config)
scim_c = ScimClient(client_config, checkpoint_service)

users = scim_c.get_users_from_log()
# print("Updating {len(users)}...")
for u in users:
print(f"Updating '{u}' to '{u.lower()}'")
client.update_email_addresses(u, u.lower())

end = timer()
print("Complete email update time: " + str(timedelta(seconds=end - start)))

if args.single_user:
user_email = args.single_user
print(f"Export user {user_email} at {now}")
Expand Down
Loading