[rt-users] User ID in a script?
John Arends
jarends at uiuc.edu
Mon Mar 17 16:50:23 EDT 2008
I wrote a quick perl script that outputs a bunch of information about
all the users in my RT instance. I noticed that the ID numbers are all
over the place. One of my early users was created with an ID of 22, and
then the next user has an ID of 29, and then the next one is somewhere
in the mid 80s.
Does every object RT creates get a unique ID and when a user is created
it just gets the next one?
In my perl script, I want to loop through all the users so I can print
the infor for each one. Since this was a quick hack I just went through
the numbers 1 through 1000. Is there something built in that allows me
to do this in a more direct way? I don't want to loop until there is no
data since it seems like the ID numbes are all over the place.
#!/usr/bin/perl
use warnings;
use lib '/usr/lib/perl5/vendor_perl/5.8.5/RT';
use RT::Interface::CLI;
use RT::Ticket;
use RT::User;
RT::LoadConfig();
RT::Init();
for ($count=1; $count<1000; $count++)
{
my $user = RT::User->new( $RT::SystemUser );
$user->Load( $count );
if ( $user->Name){
print $user->RealName . " " . $user->Name . " " . $user->EmailAddress
. " " . $user->id . " " . $user->Privileged ." \n";
}
}
More information about the rt-users
mailing list