Creating users using CLI: assigning to a group?

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 Ballantyne
grahamb@sfu.ca

Institutional, Collaborative & Academic Technologies
IT Services

Simon Fraser University
Burnaby, BC V5A 1S6
p: 778-782-2014
www.sfu.ca/icat

Also: is it possible to get a list of group membership via the CLI or
perl API? The CLI help says it should be possible:

rt> help groups

Users and groups are identified by name or numeric ID.

The following generic operations may be performed upon them:

- list
- show
- edit
- create

but doing rt show group/59629 results in:

Unknown object type: group

id: group/59629On 21-Aug-08, at 22:36 , Graham Ballantyne 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 Ballantyne
grahamb@sfu.ca

Institutional, Collaborative & Academic Technologies
IT Services

Simon Fraser University
Burnaby, BC V5A 1S6
www.sfu.ca/icat

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: Contributions - Request Tracker Wiki - 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