Page 1 of 1

Bulk user creation

PostPosted: Thu Apr 14, 2016 8:38 am
by richinek
Hi Testlink fans!

every month I need to create about 10-20 Testlink accounts. I do it manually via UI. Is there any other way how to do it? Script, API...?

Thx

Re: Bulk user creation

PostPosted: Wed Sep 06, 2017 10:41 pm
by Titovetch
does anyone has a solution for this

Re: Bulk user creation

PostPosted: Fri Sep 08, 2017 3:12 pm
by fman
you have to use a simple sql script.
give a look to insert used on the sql script provided for installing testlink, there exists the line to create admin user, you can use it as model/example

Re: Bulk user creation

PostPosted: Sun Sep 10, 2017 2:58 pm
by Titovetch
Thanks Fman
i have used the below query with the same admin hash password to be "admin" as the default but its gave me this error


Error

Code: Select all
#1305 - FUNCTION testlink.HashBytes does not exist



Query
Code: Select all
 INSERT INTO /*prefix*/users (login,password,role_id,email,first,last,locale,active,cookie_string)
 VALUES ('Username','21232f297a57a5a743894a0e4a801fc3', 7,'', 'A', 'B','en_GB',1,HashBytes('MD5',CAST(RAND() AS CHAR)) + HashBytes('MD5','Username') )

Re: Bulk user creation

PostPosted: Wed Sep 13, 2017 4:14 pm
by Titovetch
appreciate your support

Re: Bulk user creation

PostPosted: Wed Sep 13, 2017 8:58 pm
by TurboPT
Which database are you using?

I believe (but I could be wrong) that the HashBytes is specific to sql server?

Re: Bulk user creation

PostPosted: Sun Sep 17, 2017 4:41 pm
by Titovetch
i'm executing that query through PHPmyadmin on the testlink database so how to crate hashcode into MYSQL

Re: Bulk user creation

PostPosted: Sun Sep 17, 2017 4:59 pm
by TurboPT
Ok, so it does look like that you have used the insert query example (with HashBytes) found in:
\install\sql\mssql\testlink_create_default_data.sql

...but for MySQL, use the insert query example found in:
\install\sql\mysql\testlink_create_default_data.sql

Re: Bulk user creation

PostPosted: Mon Sep 18, 2017 6:41 am
by Titovetch
thanks Turbo this what i have used above and the error the same

Code: Select all
INSERT INTO /*prefix*/users (login,password,role_id,email,first,last,locale,active,cookie_string)
 VALUES ('admin','21232f297a57a5a743894a0e4a801fc3', 8,'', 'Testlink', 'Administrator', 'en_GB',1,HashBytes('MD5',CAST(RAND() AS CHAR)) + HashBytes('MD5','admin') );


error
Code: Select all
#1305 - FUNCTION testlink.HashBytes does not exist

Re: Bulk user creation

PostPosted: Mon Sep 18, 2017 4:14 pm
by TurboPT
Did you not read my previous post?

The query that you have used will give the same error, because you are using the WRONG insert example for MySQL.

You need the insert user example found in the MySQL path, and NOT the MSSQL path.
See my previous post for the path differences, so that you get the example from the correct file.

Re: Bulk user creation

PostPosted: Tue Sep 19, 2017 8:27 pm
by Titovetch
Thanks Turbo ,i was opened the wrong file but the correct path so that i posted the same query again :D

Re: Bulk user creation

PostPosted: Tue Sep 19, 2017 8:29 pm
by TurboPT
So is the query good now?

Re: Bulk user creation

PostPosted: Thu Sep 21, 2017 6:16 am
by Titovetch
yes , it working good