Last active
May 6, 2019 20:06
-
-
Save bellerbrock/2d7a8c67bdefd22d5a774f1f90a847ed to your computer and use it in GitHub Desktop.
Create temp user accounts en masse for workshops
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
#here's how I was able to create temp user accounts en masse for spb workshops. Could prove useful for future workshops: | |
Step1: | |
Manually create a dummy account through the test site's user interface. Give it username 'password_source' and the password that you want to use for all the temp user accounts. | |
Then, connect to the test database using psql and run: | |
begin; | |
insert into sgn_people.sp_person (first_name, last_name, username, password, private_email, user_type) (select 'test' as first_name, 'user' || i as last_name, 'testuser' || i as username, (select password from sgn_people.sp_person where username = 'password_source') as password, 'spbuser' || i || '@mailinator.com' as email, 'submitter' as user_type from generate_Series(0,50) as i); | |
# look up range of sp_person_ids created, in this case 83-128 | |
insert into sgn_people.sp_person_roles (sp_person_id, sp_role_id) (select i as sp_person_id, 3 as sp_role_id from generate_Series(83,128) as i); | |
#check to see if everything looks right, then | |
commit; | |
Note, thanks to encrypted passwords there is now an extra step necessary. Before creating account en masse, create an account manually through the web with the desired password. then alter the sql to use select this account's password and use it for the dummy acocunts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment