[rt-users] Perl API: list of available queues, owners, status
Richard McMahon
rgm at ast.cam.ac.uk
Fri Jul 13 12:55:10 EDT 2012
OK, I have looked at:
the SelectOwnerDrop template and came up with this which does
what I want to get the list of valid owners:
my $Users = RT::Users->new( RT->SystemUser );
$Users->WhoHaveRight(
Right => 'OwnTicket',
);
while ( my $Users = $Users->Next ) {
print $Users->Name, "\n";
}
Thanks for the pointer
On Thu, 12 Jul 2012, Kevin Falcone wrote:
> Date: Thu, 12 Jul 2012 21:36:55 -0400
> From: Kevin Falcone <falcone at bestpractical.com>
> Reply-To: rt-users at lists.bestpractical.com
> To: rt-users at lists.bestpractical.com
> Subject: Re: [rt-users] Perl API: list of available queues, owners, status
>
> On Fri, Jul 13, 2012 at 01:01:05AM +0100, Richard McMahon wrote:
> > Is there an API way to get the full list of valid status values and also
>
> Have you tried running perldoc /opt/rt4/lib/RT/Queue.pm
> and searching for Status?
>
> > the list of names of ticket owners. I have looked that the code
>
> Look at what the SelectOwner template does to get an owner list.
>
> -kevin
>
> > that Ruslan mentions but I am able see how to get at the owner
> > list and list of valid status values.
> >
> > thanks
> >
> >
> >
> > I know how to this sort of thing with RAW SQL but prefer to try to
> > use the API.
> >
> > I have looked at QueueSummaryByStatus in RT4 but
> >
> >
> > thanks
> >
> >
> > On Thu, 12 Jul 2012, Kevin Falcone wrote:
> >
> > >Date: Thu, 12 Jul 2012 15:00:00 -0400
> > >From: Kevin Falcone <falcone at bestpractical.com>
> > >Reply-To: rt-users at lists.bestpractical.com
> > >To: rt-users at lists.bestpractical.com
> > >Subject: Re: [rt-users] Perl API: list of available queues, owners, status
> > >
> > >On Thu, Jul 12, 2012 at 07:43:16PM +0100, Richard McMahon wrote:
> > >>I am doing some ASCII perl reports and one of the options is to supply
> > >>the queue name. I want to be able to get a list of the queues that
> > >>are available as an input check.
> > >
> > >In that case, it's probably easier to ->Load the queue by name and see
> > >if it exists, rather than list 20 queues and name compare each.
> > >
> > >-kevin
> > >
> > >>
> > >>On Thu, 12 Jul 2012, Ruslan Zakirov wrote:
> > >>
> > >>>Date: Thu, 12 Jul 2012 21:30:15 +0300
> > >>>From: Ruslan Zakirov <ruz at bestpractical.com>
> > >>>To: Richard McMahon <rgm at ast.cam.ac.uk>
> > >>>Cc: rt-users at lists.bestpractical.com
> > >>>Subject: Re: [rt-users] Perl API: list of available queues, owners, status
> > >>>
> > >>>On Thu, Jul 12, 2012 at 7:58 PM, Richard McMahon <rgm at ast.cam.ac.uk> wrote:
> > >>>>Hello,
> > >>>>
> > >>>>Is there a way/example of how to get a list of queues, owners, status using
> > >>>>the Perl API?
> > >>>>
> > >>>>I want to cycle through making a list counts for each owner
> > >>>>and queue by status.
> > >>>
> > >>>You want count tickets groupped by queue, owner and status, right? You
> > >>>really don't want to iterate over anything. It will be very slow.
> > >>>Instead take a look at how QueueSummaryBy* files do it in RT 4.0 and
> > >>>how RT::Extension::SummaryByUser (on CPAN) does similar task. You just
> > >>>need to combine two tables into one big table.
> > >
> >
> > -------------------------------------------------------------------
> > Dr. Richard G. McMahon | Phone (office) 44-(0)-1223-337519
> > University of Cambridge | (switchboard) 1223-337548
> > Institute of Astronomy | (secretary) 1223-337516
> > Madingley Rd | FAX 1223-337523
> > Cambridge, CB3 OHA, UK. | mobile 7885-409019
> > Office: Hoyle 18 | home 1223-359770
> > -------------------------------------------------------------------
> > email: rgm at ast.cam.ac.uk | WWW: http://www.ast.cam.ac.uk/~rgm
> > richardgmcmahon at gmail.com | skype: richardgmcmahon
> > -------------------------------------------------------------------
>
-------------------------------------------------------------------
Dr. Richard G. McMahon | Phone (office) 44-(0)-1223-337519
University of Cambridge | (switchboard) 1223-337548
Institute of Astronomy | (secretary) 1223-337516
Madingley Rd | FAX 1223-337523
Cambridge, CB3 OHA, UK. | mobile 7885-409019
Office: Hoyle 18 | home 1223-359770
-------------------------------------------------------------------
email: rgm at ast.cam.ac.uk | WWW: http://www.ast.cam.ac.uk/~rgm
richardgmcmahon at gmail.com | skype: richardgmcmahon
-------------------------------------------------------------------
More information about the rt-users
mailing list