[rt-users] Creating users using CLI: assigning to a group?

Stephen Turner sturner at MIT.EDU
Mon Aug 25 09:19:18 EDT 2008


On Fri, 22 Aug 2008 01:36:02 -0400, Graham Ballantyne <grahamb at sfu.ca>  
wrote:

> I'm working on a script to create users in RT based on a list of
> usernames. I need to add these users to an RT group upon creation. I
> can do it by doing an INSERT into the GroupMembers table, but I'm
> wondering if there's a more official and elegant way?
>
>

Graham,

You'll want to stay away from trying to use direct SQL commands for  
working with RT from a script. The RT Perl API is the way to go - there's  
a lot more to even the simplest sounding update than a single SQL  
statement, and the API does it all for you. There are examples in the  
wiki: http://wiki.bestpractical.com/view/Contributions - look under  
External Utils. The rt-adduser entry is a simple example that should get  
you started. The API is documented in the code itself, and you can use  
perldoc to see it.

Steve




More information about the rt-users mailing list