[rt-devel] Understanding RT:Users

matthew zeier matthew.zeier at thirdcoast.net
Fri Sep 21 15:06:10 EDT 2001


>
> You want something like this
>
>
>  CleanEnv();
>  LoadConfig();
>  DBConnect();
>
>  my $users_obj    = new RT::Users($RT::System);
>   #new takes an RT::User or RT::CurrentUser, not a username
>  $users_obj->MemberOfGroup('6');
>
>  while (my $user = $users_obj->Next) {
>
>      dumpValue($user);
>
>  }
>  $RT::Handle->Disconnect();
>

Hurm.  That still generates a similiar error - help?

RT::Users=HASH(0x576364) was created without a CurrentUser at
/opt/rt2/lib/RT/EasySearch.pm line 27
        RT::EasySearch::_Init('RT::Users=HASH(0x576364)', undef) called at
/opt/rt2/lib/RT/Users.pm line 37
        RT::Users::_Init('RT::Users=HASH(0x576364)', undef) called at
/usr/local/lib/perl5/site_perl/5.6.0/DBIx/SearchBuilder.pm line 37
        DBIx::SearchBuilder::new('RT::Users', undef) called at ii line 23



The exact script is:

#!/usr/bin/perl -w


use strict;
use Carp;

use lib "/opt/rt2/lib";
use lib "/opt/rt2/etc";

use RT::Interface::CLI  qw(CleanEnv LoadConfig DBConnect
               GetCurrentUser GetMessageContent);

CleanEnv();
LoadConfig();
DBConnect();

use RT::Date;
use RT::Queue;
use RT::Tickets;
use RT::Users;


my $users_obj    = new RT::Users($RT::System);
#new takes an RT::User or RT::CurrentUser, not a username
$users_obj->MemberOfGroup('6');

    while (my $user = $users_obj->Next) {

        dumpValue($user);

    }

$RT::Handle->Disconnect();






More information about the Rt-devel mailing list