Scripted user creation

Given:
A list of users and what groups they should be in.

We want:
Automatic creation/disabling of RT users according to the list of users
Automatic addition/deletion of users from groups according to lists

I’ve written a perl script to handle all the work of doing this, so we
can run it every so often to generate accounts for new hires and disable
for those leaving. I’m using code from the script pointed to in the
wiki: http://www.bestpractical.com/pub/rt/contrib/3.0/Other/rtadduser
Unfortunately, it does not work. I recieve no errors, but nothing is
changed in RT. No users are created, and no users are disabled.

Using:
RT 3.0.10pre1
Solaris 8
Apache
MySQL

Any information would be greatly appreciated.

Jeremy Baumgartner
CAE UNIX Systems Staff

“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.”

  • Brian W. Kernighan

Given:
A list of users and what groups they should be in.

We want:
Automatic creation/disabling of RT users according to the list of users
Automatic addition/deletion of users from groups according to lists

I’ve written a perl script to handle all the work of doing this, so we
can run it every so often to generate accounts for new hires and disable
for those leaving. I’m using code from the script pointed to in the
wiki: http://www.bestpractical.com/pub/rt/contrib/3.0/Other/rtadduser
Unfortunately, it does not work. I recieve no errors, but nothing is
changed in RT. No users are created, and no users are disabled.

This is mostly done (not all) by ‘rt-setup-database’

rt-setup-database --insert --datafile /path/to/datafile

‘datafile’ should be like ‘initialdatafile’, look at @Users definition.

Look at the ‘rt-setup-database’ code…

Paulo Matos

|Sys & Net Admin | Servi�o de Inform�tica |
|Faculdade de Ci�ncias e Tecnologia | Tel: +351-21-2948596 |
|Universidade Nova de Lisboa | Fax: +351-21-2948548 |
|P-2829-516 Caparica | e-Mail: pjsm@fct.unl.pt |


Jeremy,

Did you try checking the return code & message from the
User->Create step?

my ($val, $msg) = $UserObj->Create(Name => $name,

If the Create is failing, $msg may give you the reason.

Steve

At Wednesday 3/31/2004 12:13 PM, Jeremy Baumgartner wrote: