From efe2a7b5bf12564bed66c1c713f445effe3513a3 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 3 Jan 2010 06:24:12 +0000 Subject: [PATCH] attempt to get more information on errors using an RT-instansiated session?? --- FS/FS/TicketSystem/RT_Internal.pm | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/FS/FS/TicketSystem/RT_Internal.pm b/FS/FS/TicketSystem/RT_Internal.pm index 033c746ba..85b2d56dd 100644 --- a/FS/FS/TicketSystem/RT_Internal.pm +++ b/FS/FS/TicketSystem/RT_Internal.pm @@ -1,7 +1,8 @@ package FS::TicketSystem::RT_Internal; use strict; -use vars qw( @ISA $DEBUG ); +use vars qw( @ISA $DEBUG $me ); +use Data::Dumper; use FS::UID qw(dbh); use FS::CGI qw(popurl); use FS::TicketSystem::RT_Libs; @@ -9,7 +10,8 @@ use RT::CurrentUser; @ISA = qw( FS::TicketSystem::RT_Libs ); -$DEBUG = 0; +$DEBUG = 1; +$me = '[FS::TicketSystem::RT_Internal]'; sub sql_num_customer_tickets { "( select count(*) from tickets @@ -36,15 +38,25 @@ sub access_right { #return '' unless $conf->config('ticket_system'); return '' unless FS::Conf->new->config('ticket_system'); - $self->_web_external_auth($session) - unless $session - && $session->{'CurrentUser'}; + if ( $session && $session->{'Current_User'} ) { + warn "$me access_right: using existing session and CurrentUser: \n". + Dumper($session->{'CurrentUser'}) + if $DEBUG; + } else { + warn "$me access_right: loading session and CurrentUser\n" if $DEBUG > 1; + $self->_web_external_auth($session); + } + + #warn "$me access_right: CurrentUser ". $session->{'CurrentUser'}. ":\n". + # ( $DEBUG>1 ? Dumper($session->{'CurrentUser'}) : '' ) + # if $DEBUG > 1; $session->{'CurrentUser'}->HasRight( Right => $right, Object => $RT::System ); } -#shameless false laziness w/rt/html/autohandler to get logged into RT from afar +#shameless false laziness w/RT::Interface::Web::AttemptExternalAuth +# to get logged into RT from afar sub _web_external_auth { my( $self, $session ) = @_; @@ -52,8 +64,8 @@ sub _web_external_auth { $session->{'CurrentUser'} = RT::CurrentUser->new(); - warn "loading RT user for $user\n" - if $DEBUG; + warn "$me _web_external_auth loading RT user for $user\n" + if $DEBUG > 1; $session->{'CurrentUser'}->Load($user); -- 2.11.0