Hello,
Just a quick followup, having done some more work on this: I think I am getting
a little closer here but I am still running up against some problems. I have
modified REST/1.0/search/ticket as follows:
<%ARGS>
$restrictUser => undef
$query
$format => undef
$orderby => undef
$fields => undef
</%ARGS>
<%INIT>
use RT::Interface::REST;
my $output = "";
my $status = "200 Ok";
my $user = new RT::User;
$user->Load($restrictUser) if ( defined $restrictUser );
$user = $session{CurrentUser} unless ( $user->Id );
my $tickets = RT::Tickets->new($user);
There are no changes anywhere further down in the file. The error message I am
getting is:
RT/4.0.6 400 Bad request
Invalid query: 'No currentuser at
/var/www/ticket.obfuscated.com/sbin/../lib/RT/Base.pm line 139.
RT::Base::loc('RT::User=HASH(0x7f14e81bff60)', 'Valid Query')
called at /var/www/ticket.obfuscated.com/sbin/../lib/RT/Base.pm line 135
RT::Base::loc('RT::Tickets=HASH(0x7f14e81c0068)', 'Valid
Query') called at /var/www/ticket.obfuscated.com/sbin/../lib/RT/Tickets_SQL.pm
line 339
RT::Tickets::FromSQL('RT::Tickets=HASH(0x7f14e81c0068)',
'queue=\'ithelp\'') called at
/var/www/ticket.obfuscated.com/share/html/REST/1.0/search/ticket line 93
eval {...} called at
/var/www/ticket.obfuscated.com/share/html/REST/1.0/search/ticket line 92
HTML::Mason::Commands::__ANON__('pass', 'obfuscated', 'query',
'queue=\'ithelp\'', 'restrictUser', 'chriso', 'user', 'chriso') called at
/usr/local/share/perl/5.10.1/HTML/Mason/Component.pm line 138
HTML::Mason::Component::run('HTML::Mason::Component::FileBased=HASH(0x637c348)',
'pass', 'obfuscated', 'query', 'queue=\'ithelp\'', 'restrictUser', 'chriso',
'user', 'chriso', ...) called at
/usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 1305
eval {...} called at
/usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 1295
HTML::Mason::Request::comp(undef, undef, undef, 'pass',
'obfuscated', 'query', 'queue=\'ithelp\'', 'restrictUser', 'chriso', ...)
called at /usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 958
HTML::Mason::Request::call_next('RT::Interface::Web::Request=HASH(0x610a820)')
called at /var/www/ticket.obfuscated.com/share/html/REST/1.0/autohandler line 54
HTML::Mason::Commands::__ANON__('pass', 'obfuscated', 'query',
'queue=\'ithelp\'', 'restrictUser', 'chriso', 'user', 'chriso') called at
/usr/local/share/perl/5.10.1/HTML/Mason/Component.pm line 138
HTML::Mason::Component::run('HTML::Mason::Component::FileBased=HASH(0x638c730)',
'pass', 'obfuscated', 'query', 'queue=\'ithelp\'', 'restrictUser', 'chriso',
'user', 'chriso', ...) called at
/usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 1305
eval {...} called at
/usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 1295
HTML::Mason::Request::comp(undef, undef, undef, 'pass',
'obfuscated', 'query', 'queue=\'ithelp\'', 'restrictUser', 'chriso', ...)
called at /var/www/ticket.obfuscated.com/sbin/../lib/RT/Interface/Web.pm line
568
RT::Interface::Web::ShowRequestedPage('HASH(0x6386cc0)') called
at /var/www/ticket.obfuscated.com/sbin/../lib/RT/Interface/Web.pm line 318
RT::Interface::Web::HandleRequest('HASH(0x6386cc0)') called at
/var/www/ticket.obfuscated.com/share/html/autohandler line 53
HTML::Mason::Commands::__ANON__('pass', 'obfuscated', 'query',
'queue=\'ithelp\'', 'restrictUser', 'chriso', 'user', 'chriso') called at
/usr/local/share/perl/5.10.1/HTML/Mason/Component.pm line 138
HTML::Mason::Component::run('HTML::Mason::Component::FileBased=HASH(0x638d0c0)',
'pass', 'obfuscated', 'query', 'queue=\'ithelp\'', 'restrictUser', 'chriso',
'user', 'chriso', ...) called at
/usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 1300
eval {...} called at
/usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 1295
HTML::Mason::Request::comp(undef, undef, undef, 'pass',
'obfuscated', 'query', 'queue=\'ithelp\'', 'restrictUser', 'chriso', ...)
called at /usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 484
eval {...} called at
/usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 484
eval {...} called at
/usr/local/share/perl/5.10.1/HTML/Mason/Request.pm line 436
HTML::Mason::Request::exec('RT::Interface::Web::Request=HASH(0x610a820)')
called at /usr/local/share/perl/5.10.1/HTML/Mason/PSGIHandler.pm line 85
eval {...} called at
/usr/local/share/perl/5.10.1/HTML/Mason/PSGIHandler.pm line 85
HTML::Mason::Request::PSGI::exec('RT::Interface::Web::Request=HASH(0x610a820)')
called at /usr/local/share/perl/5.10.1/HTML/Mason/Interp.pm line 345
HTML::Mason::Interp::exec(undef, undef, 'pass', 'obfuscated',
'query', 'queue=\'ithelp\'', 'restrictUser', 'chriso', 'user', ...) called at
/usr/local/share/perl/5.10.1/HTML/Mason/PSGIHandler.pm line 48
eval {...} called at
/usr/local/share/perl/5.10.1/HTML/Mason/PSGIHandler.pm line 48
HTML::Mason::PSGIHandler::invoke_mason('HTML::Mason::PSGIHandler::Streamy=HASH(0x6222bf8)',
'HTML::Mason::FakeApache=HASH(0x631a2d8)', 'HASH(0x375e6d8)') called at
/usr/local/share/perl/5.10.1/HTML/Mason/PSGIHandler/Streamy.pm line 52
HTML::Mason::PSGIHandler::Streamy::__ANON__('CODE(0x6317778)')
called at
/var/www/ticket.obfuscated.com/sbin/../lib/RT/Interface/Web/Handler.pm line 263
RT::Interface::Web::Handler::__ANON__('CODE(0x6317778)') called
at /usr/local/share/perl/5.10.1/Plack/Util.pm line 301
Plack::Util::__ANON__('CODE(0x63174d8)') called at
/usr/local/share/perl/5.10.1/Plack/Handler/FCGI.pm line 130
Plack::Handler::FCGI::run('Plack::Handler::FCGI=HASH(0x6258528)',
'CODE(0x60f4760)') called at /usr/local/share/perl/5.10.1/Plack/Loader.pm line
84
Plack::Loader::run('Plack::Loader=HASH(0x622f070)',
'Plack::Handler::FCGI=HASH(0x6258528)') called at
/usr/local/share/perl/5.10.1/Plack/Runner.pm line 267
Plack::Runner::run('Plack::Runner=HASH(0x5b596b8)',
'CODE(0x60f4760)') called at /var/www/ticket.obfuscated.com/sbin/rt-server.fcgi
line 232
eval {...} called at
/var/www/ticket.obfuscated.com/sbin/rt-server.fcgi line 232
Stack:
[/usr/local/share/perl/5.10.1/Carp.pm:101]
[/var/www/ticket.obfuscated.com/sbin/../lib/RT/Base.pm:139]
[/var/www/ticket.obfuscated.com/sbin/../lib/RT/Base.pm:135]
[/var/www/ticket.obfuscated.com/sbin/../lib/RT/Tickets_SQL.pm:339]
[/var/www/ticket.obfuscated.com/share/html/REST/1.0/search/ticket:93]
[/var/www/ticket.obfuscated.com/share/html/REST/1.0/autohandler:54]
[/var/www/ticket.obfuscated.com/sbin/../lib/RT/Interface/Web.pm:568]
[/var/www/ticket.obfuscated.com/sbin/../lib/RT/Interface/Web.pm:318]
[/var/www/ticket.obfuscated.com/share/html/autohandler:53]
'.
So it seems to get through to running the query in search/ticket, and in
Tickets_SQL it gets to the point of returning "Valid Query", however I have
problems when it gets to this 'loc' function. Reading suggests to me it is for
localization of strings but I flat out do not understand it's logic. If I read
Base.pm correctly (and I assume I did not), the loc sub checks if it's passed
argument has an OriginalUser property and, if it does, returns the value
returned by calling itself on that user... if the argument does have an
OriginalUser method it returns an error. This makes it seems as though it will
always either return an error or begin an infinite loop. I've added a logger
statement right before the loc call in Tickets_SQL.pm to log the value of
$Self->OriginalUser->Id and it always logs a value (my id, fwiw) so as far as I
can tell there is an OriginalUser property. Any thoughts?
Chris O'Kelly
Web Administrator
Minecorp Australia
37 Murdoch Circuit
Acacia Ridge QLD 4110
minecorp.com.au<http://www.minecorp.com.au>
P: 07 3723 1000
M: 0450 586 190
E: [email protected]<mailto:[email protected]>
S: chris.okelly.mvs<http://skype.com>
[http://oi46.tinypic.com/mw8nbd.jpg]
--------
Final RT training for 2012 in Atlanta, GA - October 23 & 24
http://bestpractical.com/training
We're hiring! http://bestpractical.com/jobs