Created
January 26, 2015 17:25
-
-
Save mattias-lidman/768c86badd7698bf0cbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
# Get all OA4MP linked identities as a flat list | |
user_list = users.get_all_users() # Do this as a separate step because it's started timing out regularly | |
oauth_creds = itertools.chain.from_iterable([ user.credentials.get_all_credentials_of_type('oauth') for user in user_list if user.credentials.get_all_credentials_of_type('oauth')]) | |
# Filter out bluewaters | |
bluewaters_creds = [ cred for cred in oauth_creds if cred['server'] == 'bluewaters.ncsa.illinois.edu' ] | |
# Update | |
for cred in bluewaters_creds: cred['server'] = 'oa4mp.ncsa.illinois.edu'; cred['id_index'] = "{0}_{1}".format(cred['oauth_username'], 'oa4mp.ncsa.illinois.edu'); cred.commit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment