[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.5-198-g5e2481a

Alex M Vandiver alexmv at bestpractical.com
Tue Sep 29 21:12:14 EDT 2009


The branch, 3.8-trunk has been updated
       via  5e2481a26b7475d21538868794b3da8b60ed69f1 (commit)
       via  429d2ba1958bef960fdf391b57587681c888d3ae (commit)
       via  a1928d0ce6f182c8a2bb5a46b6dac5b195ba6868 (commit)
       via  390be83f30538d0f73c6afb160e83173d308984d (commit)
       via  33592fb9f0133c4b34bf4d7ed2604ecb6e00140a (commit)
       via  6ed7615cbda10dba01e84cc49a4f872640e9b1a3 (commit)
       via  a54efa3ea15c013159c5dd0f6cfd6b3aca10f092 (commit)
       via  60a46091e341f905b4833ce98ec1e903acb41cc9 (commit)
       via  b3b465485d0abb9c0a9cb06fb62c45326287069d (commit)
       via  75ae492d59003c447adc57efecd21d3bdf2a56ba (commit)
      from  897fcddcea65bfc1daa03678975ae69ae46bb825 (commit)

Summary of changes:
 lib/RT/Interface/Web.pm |   49 ++++++++++++++++++++++------------------------
 1 files changed, 23 insertions(+), 26 deletions(-)

- Log -----------------------------------------------------------------
commit 75ae492d59003c447adc57efecd21d3bdf2a56ba
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 20:48:09 2009 -0400

    Refactor MaybeShowInstallModePage to bail early

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 7db2d60..90d5159 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -253,18 +253,17 @@ If it serves a page, it stops mason processing. Otherwise, mason just keeps runn
 =cut 
 
 sub MaybeShowInstallModePage {
+    return unless RT->InstallMode;
 
     my $m = $HTML::Mason::Commands::m;
-    if ( RT->InstallMode ) {
-        if ( $m->base_comp->path =~ RT->Config->Get('WebNoAuthRegex') ) {
-            $m->call_next();
-        } elsif ( $m->request_comp->path !~ '^(/+)Install/' ) {
-            RT::Interface::Web::Redirect( RT->Config->Get('WebURL') . "Install/index.html" );
-        } else {
-            $m->call_next();
-        }
-        $m->abort();
+    if ( $m->base_comp->path =~ RT->Config->Get('WebNoAuthRegex') ) {
+        $m->call_next();
+    } elsif ( $m->request_comp->path !~ '^(/+)Install/' ) {
+        RT::Interface::Web::Redirect( RT->Config->Get('WebURL') . "Install/index.html" );
+    } else {
+        $m->call_next();
     }
+    $m->abort();
 }
 
 =head2 MaybeShowNoAuthPage  \%ARGS

commit b3b465485d0abb9c0a9cb06fb62c45326287069d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 20:48:34 2009 -0400

    Refactor MaybeShowNoAuthPage to bail early

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 90d5159..b407aec 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -278,13 +278,13 @@ If it serves a page, it stops mason processing. Otherwise, mason just keeps runn
 sub MaybeShowNoAuthPage {
     my $ARGS = shift;
 
+    return unless $m->base_comp->path =~ RT->Config->Get('WebNoAuthRegex');
+
     # If it's a noauth file, don't ask for auth.
     my $m = $HTML::Mason::Commands::m;
-    if ( $m->base_comp->path =~ RT->Config->Get('WebNoAuthRegex') ) {
-        SendSessionCookie();
-        $m->comp( { base_comp => $m->request_comp }, $m->fetch_next, %$ARGS );
-        $m->abort;
-    }
+    SendSessionCookie();
+    $m->comp( { base_comp => $m->request_comp }, $m->fetch_next, %$ARGS );
+    $m->abort;
 }
 
 =head2 ShowRequestedPage  \%ARGS

commit 60a46091e341f905b4833ce98ec1e903acb41cc9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 20:48:49 2009 -0400

    Fix name of method in POD

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index b407aec..f01d249 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -434,7 +434,7 @@ sub AttemptPasswordAuthentication {
     $m->callback( %$ARGS, CallbackName => 'SuccessfulLogin', CallbackPage => '/autohandler' );
 }
 
-=head2 LoadSessionCookie
+=head2 LoadSessionFromCookie
 
 Load or setup a session cookie for the current user.
 

commit a54efa3ea15c013159c5dd0f6cfd6b3aca10f092
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 20:49:06 2009 -0400

    Make indirect object notation die

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index f01d249..9198ee0 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -474,7 +474,7 @@ sub InstantiateNewSession {
 }
 
 sub SendSessionCookie {
-    my $cookie = new CGI::Cookie(
+    my $cookie = CGI::Cookie->new(
         -name   => _SessionCookieName(),
         -value  => $HTML::Mason::Commands::session{_session_id},
         -path   => RT->Config->Get('WebPath'),

commit 6ed7615cbda10dba01e84cc49a4f872640e9b1a3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 20:49:36 2009 -0400

    After calling $m->comp in autohandler, we should always abort

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 9198ee0..b9ce266 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -383,8 +383,9 @@ sub AttemptExternalAuth {
 
                 # we failed to successfully create the user. abort abort abort.
                 delete $HTML::Mason::Commands::session{'CurrentUser'};
-                $m->abort unless RT->Config->Get('WebFallbackToInternalAuth');
-                $m->comp( '/Elements/Login', %$ARGS, Error => loc( 'Cannot create user: [_1]', $msg ) );
+                $m->comp( '/Elements/Login', %$ARGS, Error => loc( 'Cannot create user: [_1]', $msg ) )
+                    if RT->Config->Get('WebFallbackToInternalAuth');;
+                $m->abort();
             }
         }
 

commit 33592fb9f0133c4b34bf4d7ed2604ecb6e00140a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 20:53:14 2009 -0400

    Use _UserLoggedIn() abstraction in a couple more places

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index b9ce266..61e9745 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -351,7 +351,7 @@ sub AttemptExternalAuth {
         $HTML::Mason::Commands::session{'CurrentUser'} = RT::CurrentUser->new();
         $HTML::Mason::Commands::session{'CurrentUser'}->$load_method($user);
 
-        if ( RT->Config->Get('WebExternalAuto') && !$HTML::Mason::Commands::session{'CurrentUser'}->Id ) {
+        if ( RT->Config->Get('WebExternalAuto') and not _UserLoggedIn() ) {
 
             # Create users on-the-fly
             my $UserObj = RT::User->new($RT::SystemUser);
@@ -389,7 +389,7 @@ sub AttemptExternalAuth {
             }
         }
 
-        if ( $HTML::Mason::Commands::session{'CurrentUser'}->Id ) {
+        if ( _UserLoggedIn() ) {
             $m->callback( %$ARGS, CallbackName => 'ExternalAuthSuccessfulLogin', CallbackPage => '/autohandler' );
         } else {
             delete $HTML::Mason::Commands::session{'CurrentUser'};

commit 390be83f30538d0f73c6afb160e83173d308984d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 21:11:15 2009 -0400

    Move comment to appropriate place

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 61e9745..900e6aa 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -207,9 +207,8 @@ sub HandleRequest {
         # If the user is logging in, let's authenticate
         if ( defined $ARGS->{user} && defined $ARGS->{pass} ) {
             AttemptPasswordAuthentication($ARGS);
-
-            # if no credentials then show him login page
         } else {
+            # if no credentials then show him login page
             $HTML::Mason::Commands::m->comp( '/Elements/Login', %$ARGS );
             $HTML::Mason::Commands::m->abort;
         }

commit a1928d0ce6f182c8a2bb5a46b6dac5b195ba6868
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 21:11:27 2009 -0400

    Remove unreachable statement

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 900e6aa..511e241 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -214,8 +214,6 @@ sub HandleRequest {
         }
     }
 
-    warn "Not logged in! " unless _UserLoggedIn();
-
     # now it applies not only to home page, but any dashboard that can be used as a workspace
     $HTML::Mason::Commands::session{'home_refresh_interval'} = $ARGS->{'HomeRefreshInterval'}
         if ( $ARGS->{'HomeRefreshInterval'} );

commit 429d2ba1958bef960fdf391b57587681c888d3ae
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 21:11:43 2009 -0400

    Note unreachable codepath

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 511e241..137de82 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -399,6 +399,7 @@ sub AttemptExternalAuth {
         }
     } elsif ( RT->Config->Get('WebFallbackToInternalAuth') ) {
         unless ( defined $HTML::Mason::Commands::session{'CurrentUser'} ) {
+            # XXX unreachable due to prior defaulting in HandleRequest (check c34d108)
             $m->comp( '/Elements/Login', %$ARGS, Error => loc('You are not an authorized user') );
             $m->abort();
         }

commit 5e2481a26b7475d21538868794b3da8b60ed69f1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Sep 29 21:11:59 2009 -0400

    Whitespace shifts

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 137de82..a090fa8 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -184,10 +184,10 @@ sub HandleRequest {
         if ( $HTML::Mason::Commands::m->request_comp->attr_exists('AutoFlush') );
 
     DecodeARGS($ARGS);
-
     PreprocessTimeUpdates($ARGS);
 
     MaybeShowInstallModePage();
+
     $HTML::Mason::Commands::m->comp( '/Elements/SetupSessionCookie', %$ARGS );
     SendSessionCookie();
     $HTML::Mason::Commands::session{'CurrentUser'} = RT::CurrentUser->new() unless _UserLoggedIn();
@@ -223,7 +223,6 @@ sub HandleRequest {
 
     ShowRequestedPage($ARGS);
     LogRecordedSQLStatements();
-
 }
 
 sub _ForceLogout {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list