Bulk user creation

LATEST Official version.
Questions and discussions - NO ISSUES
FOR ISSUES => http://mantis.testlink.org

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
richinek
Advanced user
Posts: 19
Joined: Thu Jan 13, 2011 8:39 am

Bulk user creation

Post 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
Titovetch
Advanced user
Posts: 19
Joined: Sat Jun 17, 2017 2:24 pm

Re: Bulk user creation

Post by Titovetch »

does anyone has a solution for this
fman
Member of TestLink Community
Posts: 3102
Joined: Tue Nov 15, 2005 7:19 am

Re: Bulk user creation

Post 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
Titovetch
Advanced user
Posts: 19
Joined: Sat Jun 17, 2017 2:24 pm

Re: Bulk user creation

Post 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') )
Titovetch
Advanced user
Posts: 19
Joined: Sat Jun 17, 2017 2:24 pm

Re: Bulk user creation

Post by Titovetch »

appreciate your support
TurboPT
Member of TestLink Community
Posts: 343
Joined: Sun Dec 10, 2006 4:51 am

Re: Bulk user creation

Post by TurboPT »

Which database are you using?

I believe (but I could be wrong) that the HashBytes is specific to sql server?
Titovetch
Advanced user
Posts: 19
Joined: Sat Jun 17, 2017 2:24 pm

Re: Bulk user creation

Post by Titovetch »

i'm executing that query through PHPmyadmin on the testlink database so how to crate hashcode into MYSQL
TurboPT
Member of TestLink Community
Posts: 343
Joined: Sun Dec 10, 2006 4:51 am

Re: Bulk user creation

Post 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
Titovetch
Advanced user
Posts: 19
Joined: Sat Jun 17, 2017 2:24 pm

Re: Bulk user creation

Post 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
TurboPT
Member of TestLink Community
Posts: 343
Joined: Sun Dec 10, 2006 4:51 am

Re: Bulk user creation

Post 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.
Titovetch
Advanced user
Posts: 19
Joined: Sat Jun 17, 2017 2:24 pm

Re: Bulk user creation

Post by Titovetch »

Thanks Turbo ,i was opened the wrong file but the correct path so that i posted the same query again :D
TurboPT
Member of TestLink Community
Posts: 343
Joined: Sun Dec 10, 2006 4:51 am

Re: Bulk user creation

Post by TurboPT »

So is the query good now?
Titovetch
Advanced user
Posts: 19
Joined: Sat Jun 17, 2017 2:24 pm

Re: Bulk user creation

Post by Titovetch »

yes , it working good
Post Reply