Have look onto this tiny piece of code...<br><br><a href="http://createuser.pl">createuser.pl</a><br><br>#!/usr/bin/perl<br>use strict;<br>use warnings;<br><br>BEGIN { die "You must define \$RT_HOME\n"<br> unless exists $ENV{RT_HOME} };<br>
use lib "$ENV{RT_HOME}/lib";<br><br>use RT;<br>RT::LoadConfig();<br>RT::Init();<br><br>use RT::Interface::CLI qw(GetCurrentUser loc);<br>use RT::Tickets;<br><br>my $CurrentUser = GetCurrentUser();<br>die loc("No RT user found.\n") unless ($CurrentUser->Id);<br>
die "We need exactly 2 Arguments, Name & Email\n" unless ($#ARGV==1);<br>my $UserName=shift @ARGV;<br>my $Email=shift @ARGV;<br>my $User = RT::User->new($CurrentUser);<br>my ($id,$Message)=$User->Create(Name=>$UserName,EmailAddress=>$Email,Privileged=>1,Password=>'apassword');<br>
if ($id){<br> print $Message."\n";<br> }<br> else{<br> print"This is a error!\n$Message\n";<br> }<br><br>triggered from a shell script like these:<br>
<br>#!/bin/bash<br>export RT_HOME=/opt/rt3<br>P1=/opt/rt3/local/bin/<br>U1=/opt/rt3/local/bin/userlist<br><br>while read zeile; do<br> set -- $zeile<br> echo "Bearbeite User: "$1 $2<br> /usr/bin/perl ${P1}<a href="http://creatertuser.pl">creatertuser.pl</a> $1 $2<br>
done<$U1<br><br>you need a csv file called userlist with the needed values.<br><br><div class="gmail_quote">2010/8/3 Carol Sabbar <span dir="ltr"><<a href="mailto:csabbar@carthage.edu">csabbar@carthage.edu</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Checking to see if my messages are going through. I have asked this question twice and haven't seen my question go out or any answers to it. Please! Need help!<div>
<div></div><div class="h5"><br><br>
<div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Carol Sabbar</b> <span dir="ltr"><<a href="mailto:csabbar@carthage.edu" target="_blank">csabbar@carthage.edu</a>></span><br>
Date: Thu, Jul 29, 2010 at 9:42 AM<br>
Subject: Batch user import?<br>To: rt-users <<a href="mailto:rt-users@lists.bestpractical.com" target="_blank">rt-users@lists.bestpractical.com</a>><br><br><br>I'd like to import users into Request Tracker from a CSV or similar file. I found some info on gossamer, but not enough to get a working solution. Any really practical solutions are really appreciated.<br clear="all">
<font color="#888888"><br>-- <br>Carol Sabbar<br>Director of Information Services<br>Carthage College<br><a href="mailto:csabbar@carthage.edu" target="_blank">csabbar@carthage.edu</a><br></font></div><br><br clear="all">
<br>
-- <br>Carol Sabbar<br>Director of Information Services<br>Carthage College<br><a href="mailto:csabbar@carthage.edu" target="_blank">csabbar@carthage.edu</a><br>
</div></div><br><br>
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.<br>
Buy a copy at <a href="http://rtbook.bestpractical.com" target="_blank">http://rtbook.bestpractical.com</a><br></blockquote></div><br><br clear="all"><br>-- <br>MFG<br><br>Torsten Brumm<br><br><a href="http://www.brumm.me">http://www.brumm.me</a><br>
<a href="http://www.elektrofeld.de">http://www.elektrofeld.de</a><br>