Forum .LRN Q&A: Re: Re: Re: Bulk User Account problem

Collapse
Posted by Matthew Coupe on
OK, I haven't been able to sort out this problem and would really love some advice. I've had a look at the users-bulk-upload-2.tcl file and the important bit is

set user_id [db_nextval acs_object_id_seq]

auth::create_user \
-user_id $user_id \
-username "$row(username)" \
-email $row(email) \
-first_names $row(first_names) \
-last_name $row(last_name) \
-password $password

I have seen in some bug fixes that it should actually be changed to this instead...

set user_id [ad_user_new $row(email) $row(first_names) $row(last_name) $password "" "" "" "t" "approved"]

Anyone know anything about this and how it should read?

Thanks,
Matthew

Collapse
Posted by Malte Sussdorff on
Okay, the auth::create_user is correct and the way to go.

What I would check though is to write out all variables like user_id, $row(username) and so on into your logfile using ns_log Notice to make sure your CSV file is correct and all data is present. Furthermore make sure that you CSV file does not contain extra "," where they don't belong.

Collapse
Posted by Matthew Coupe on
Thanks for getting back Malte.
I have tried it with the following CSV files:

username,password,first_names,last_name,email,id,type,access_level,guest,notify
joestue,4jfe3,Joe,Student,mailto:joe@_somewhere_.net,1234567890,student,full,f,f

email,first_names,last_name,username
mailto:bob@_blabla_.com,matty,bob,foobar

username,password,first_names,last_name,email,id,type,access_level,guest,notify
joestue,4jfe3,Joe,Student,mailto:joe@_somewhere_.net,123-456-7890,student,full,f,f
al1stein,emc2,Albert,Einstein,mailto:al@_school_.edu,al,professor,full,f,t
syshack,,Systems,Hacker,mailto:syshacker@_company_.com,,admin,,,,
tester,test,Intersted,Onlooker,mailto:onlooker@_somewhere_.net,,external,limited,t,t

I have searched through them with a toothpick and couldn't find anything wrong with any of them. I may be really stupid and have missed something REALLY obvious out of this file...

I'll try the ns_log now and see what I can get. I hope I can get this fixed because we've got 20,000 accounts to create in the next month!

Matthew

Collapse
Posted by Malte Sussdorff on
I assume that you do not have spaces in your e-mail address CSV, otherwise this would be the first thing to do "regsub -all { } $email {} email".

Furthermore make absolutely sure that there is no blank line or anything like this in your CSV file at the end.

And last but not least, think about getting rid of the db_transaction and just log (instead of stop) on error, so you know which users failed to get inserted.