I’m trying to work on a nag script that uses the RT infrastructure.
I want to gather a list of group members and cycle through their open/new
tickets that haven’t been updated in $x days. I’m using some nag script I
found in contrib or somewhere else as a framework.
I’m unclear on how to get a list of group members.
my $users = new RT::Users->MemberOfGroup(‘6’);
How do I cycle through that list?
matthew zeier - “In mathematics you don’t understand things. You just
get used to them.” - John von Newmann
RT::Users, like all of the collection objects in RT is a subclass of DBIx::SearchBuilder.
You can either call while (my $user = $users->Next) {
or work with $users->ItemsArrayRefOn Thu, Sep 20, 2001 at 11:57:33AM -0700, matthew zeier wrote:
I’m trying to work on a nag script that uses the RT infrastructure.
I want to gather a list of group members and cycle through their open/new
tickets that haven’t been updated in $x days. I’m using some nag script I
found in contrib or somewhere else as a framework.
I’m unclear on how to get a list of group members.
my $users = new RT::Users->MemberOfGroup(‘6’);
How do I cycle through that list?
–
matthew zeier - “In mathematics you don’t understand things. You just
get used to them.” - John von Newmann
rt-devel mailing list
rt-devel@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-devel
http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.
RT::Users, like all of the collection objects in RT is a subclass of
DBIx::SearchBuilder.
You can either call while (my $user = $users->Next) {
or work with $users->ItemsArrayRef
I think I’m missing something here - can someone point me in the right
direction?
Can’t locate object method “Next” via package “GroupMembers_1” at i line 35.
Script is:
CleanEnv();
LoadConfig();
DBConnect();
my $user_obj = new RT::Users(‘mrz’);
my $users = $user_obj->MemberOfGroup(‘6’);
while (my $user = $users->Next) {
dumpValue(\$user);
}
$RT::Handle->Disconnect();
RT::Users, like all of the collection objects in RT is a subclass of
DBIx::SearchBuilder.
You can either call while (my $user = $users->Next) {
or work with $users->ItemsArrayRef
I think I’m missing something here - can someone point me in the right
direction?
Can’t locate object method “Next” via package “GroupMembers_1” at i line 35.
Script is:
CleanEnv();
LoadConfig();
DBConnect();
my $user_obj = new RT::Users(‘mrz’);
my $users = $user_obj->MemberOfGroup(‘6’);
while (my $user = $users->Next) {
dumpValue(\$user);
}
$RT::Handle->Disconnect();
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();
http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.
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();
Er. How about $RT::SystemUser.
you need to be sure you have an RT::User or RT::CurrentUser object to work with
any objects in the system or the ACL system won’t be happy.On Fri, Sep 21, 2001 at 12:06:10PM -0700, matthew zeier wrote:
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();
http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.