[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.5-165-g0966ecc

jesse jesse at bestpractical.com
Tue Sep 29 15:51:52 EDT 2009


The branch, 3.8-trunk has been updated
       via  0966ecc1a8a0561c062dbee32e71e92f163f4827 (commit)
       via  573d0b24f36ad68b4e4c56a318ea11c4b63e4086 (commit)
       via  7f51d803d08d34559a602a1f543e724b1431fc14 (commit)
       via  1da07fd59a587f3cf854b2956d7a15dc90a63538 (commit)
       via  8a855e26e02b01c9a6279372fc19c2e49cdf285d (commit)
       via  c02a047827cd034a40810c7a936ad34b19cfe4ba (commit)
       via  de2fdac510beff91f532116e7f545ec8e794ee21 (commit)
      from  1e697a2754b62088ed7bfccba99173856953e809 (commit)

Summary of changes:
 lib/RT/Interface/Web.pm    |   48 +++++++++++++++++++++++++++++++++-
 share/html/autohandler     |   61 +++++++++++++-------------------------------
 t/mail/extractsubjecttag.t |    1 -
 t/ticket/requestor-order.t |    2 +-
 4 files changed, 66 insertions(+), 46 deletions(-)

- Log -----------------------------------------------------------------
commit de2fdac510beff91f532116e7f545ec8e794ee21
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 30 03:57:21 2009 +0900

    Tidying

diff --git a/share/html/autohandler b/share/html/autohandler
index 60eca6c..2e5ce8d 100755
--- a/share/html/autohandler
+++ b/share/html/autohandler
@@ -50,12 +50,11 @@ use RT::Util;
 
 $m->callback( ARGSRef => \%ARGS, CallbackName => 'Init' );
 
-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");
+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();
     }
@@ -72,9 +71,7 @@ RT::Interface::Web::MaybeEnableSQLStatementLog();
 local *session unless $m->is_subrequest;
 
 # Disable AutoFlush using an attribute
-if ( $m->request_comp->attr_exists('AutoFlush') ) {
-    $m->autoflush( $m->request_comp->attr('AutoFlush') );
-}
+$m->autoflush( $m->request_comp->attr('AutoFlush') ) if ( $m->request_comp->attr_exists('AutoFlush') );
 
 
 %ARGS = RT::Interface::Web::DecodeARGS(\%ARGS);
@@ -207,20 +204,13 @@ unless( $session{'CurrentUser'} ) {
     }
 }
 
-# now it applies not only to home page, but any dashboard
-# that can be used as a workspace
+# now it applies not only to home page, but any dashboard that can be used as a workspace
 $session{'home_refresh_interval'} = $ARGS{'HomeRefreshInterval'} if ( $ARGS{'HomeRefreshInterval'} ); 
 
-# we've got credentials, let's serve the file up.
 # Process per-page global callbacks
 $m->callback( %ARGS );
-
-
 RT::Interface::Web::ShowRequestedPage(\%ARGS);
-
-
 RT::Interface::Web::LogRecordedSQLStatements();
-
 $m->comp( '/Elements/Footer', %ARGS );
 
 </%INIT>

commit c02a047827cd034a40810c7a936ad34b19cfe4ba
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 30 04:24:21 2009 +0900

    extract noauth page rendering to a function

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index ab454c0..e3fcadc 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -166,10 +166,32 @@ sub WebExternalAutoInfo {
 # }}}
 
 
+=head2 MaybeShowNoAuthPage  \%ARGS
+
+This function, called exclusively by RT's autohandler, dispatches
+a request to the page a user requested (but only if it matches the "noauth" regex.
+
+If it serves a page, it stops mason processing. Otherwise, mason just keeps running through the autohandler
+
+=cut 
+
+
+sub MaybeShowNoAuthPage {
+    my $ARGS = shift;
+
+    # 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') ) {
+        $m->comp( { base_comp => $m->request_comp }, $m->fetch_next, %$ARGS );
+        $m->abort;
+    }
+}
+
+
 =head2 ShowRequestedPage  \%ARGS
 
 This function, called exclusively by RT's autohandler, dispatches
-a request to the page a user requested (making sure that unprivileg users
+a request to the page a user requested (making sure that unpriviled users
 can only see self-service pages.
 
 =cut 
diff --git a/share/html/autohandler b/share/html/autohandler
index 2e5ce8d..cfb899f 100755
--- a/share/html/autohandler
+++ b/share/html/autohandler
@@ -91,13 +91,12 @@ unless ( $session{'CurrentUser'} && $session{'CurrentUser'}->Id ) {
 # Set the proper encoding for the current language handle
 $r->content_type("text/html; charset=utf-8");
 
-# If it's a noauth file, don't ask for auth.
-if ( $m->base_comp->path =~ RT->Config->Get('WebNoAuthRegex') ) {
-    $m->comp( { base_comp => $m->request_comp }, $m->fetch_next, %ARGS);
-    $m->abort;
-}
+RT::Interface::Web::MaybeShowNoAuthPage(\%ARGS);
+
+
+
 # If RT is configured for external auth, let's go through and get REMOTE_USER
-elsif ( RT->Config->Get('WebExternalAuth') ) {
+if ( RT->Config->Get('WebExternalAuth') ) {
 
     # do we actually have a REMOTE_USER equivlent?
     if ( RT::Interface::Web::WebCanonicalizeInfo() ) {
@@ -146,9 +145,9 @@ elsif ( RT->Config->Get('WebExternalAuth') ) {
             }
         }
 
-        if ( $session{'CurrentUser'}->Id ) {
-            $m->callback(%ARGS, CallbackName => 'ExternalAuthSuccessfulLogin');
-        }
+		if ( $session{'CurrentUser'}->Id ) {
+            $m->callback(%ARGS, CallbackName => 'ExternalAuthSuccessfulLogin') 
+		}
         else {
             delete $session{'CurrentUser'};
             $user = $orig_user;

commit 8a855e26e02b01c9a6279372fc19c2e49cdf285d
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 30 04:37:51 2009 +0900

    Extract out the installmode dispatch code into Interface/Web.pm

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index e3fcadc..ea8dd2b 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -165,6 +165,30 @@ sub WebExternalAutoInfo {
 
 # }}}
 
+=head2 MaybeShowInstallModePage
+
+This function, called exclusively by RT's autohandler, dispatches
+a request to RT's Installation workflow, only if Install Mode is enabled in the configuration file.
+
+If it serves a page, it stops mason processing. Otherwise, mason just keeps running through the autohandler
+
+=cut
+
+
+sub MaybeShowInstallModePage {
+
+    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();
+    }
+}
 
 =head2 MaybeShowNoAuthPage  \%ARGS
 
diff --git a/share/html/autohandler b/share/html/autohandler
index cfb899f..fb95fb7 100755
--- a/share/html/autohandler
+++ b/share/html/autohandler
@@ -48,18 +48,9 @@
 <%INIT>
 use RT::Util;
 
-$m->callback( ARGSRef => \%ARGS, CallbackName => 'Init' );
-
-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();
-    }
-    return;
-}
+$m->callback( ARGSRef => \%ARGS, CallbackName => 'Init', CallbackPage => '/autohandler' );
+
+RT::Interface::Web::MaybeShowInstallModePage();
 
 # Roll back any dangling transactions from a previous failed connection
 $RT::Handle->ForceRollback() if $RT::Handle->TransactionDepth;

commit 1da07fd59a587f3cf854b2956d7a15dc90a63538
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 30 04:38:21 2009 +0900

    whitespace

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index ea8dd2b..8b63464 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -165,14 +165,14 @@ sub WebExternalAutoInfo {
 
 # }}}
 
-=head2 MaybeShowInstallModePage
+=head2 MaybeShowInstallModePage 
 
 This function, called exclusively by RT's autohandler, dispatches
 a request to RT's Installation workflow, only if Install Mode is enabled in the configuration file.
 
 If it serves a page, it stops mason processing. Otherwise, mason just keeps running through the autohandler
 
-=cut
+=cut 
 
 
 sub MaybeShowInstallModePage {

commit 7f51d803d08d34559a602a1f543e724b1431fc14
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 30 04:38:28 2009 +0900

    Start specifying exact page on all the autohandler callbacks so we can safely move them

diff --git a/share/html/autohandler b/share/html/autohandler
index fb95fb7..3b59418 100755
--- a/share/html/autohandler
+++ b/share/html/autohandler
@@ -64,15 +64,10 @@ local *session unless $m->is_subrequest;
 # Disable AutoFlush using an attribute
 $m->autoflush( $m->request_comp->attr('AutoFlush') ) if ( $m->request_comp->attr_exists('AutoFlush') );
 
-
 %ARGS = RT::Interface::Web::DecodeARGS(\%ARGS);
-
 RT::Interface::Web::PreprocessTimeUpdates(\%ARGS);
 
-
-
 $m->{'rt_base_time'} = [ Time::HiRes::gettimeofday() ];
-
 $m->comp( '/Elements/SetupSessionCookie', %ARGS );
 
 unless ( $session{'CurrentUser'} && $session{'CurrentUser'}->Id ) {
@@ -121,7 +116,7 @@ if ( RT->Config->Get('WebExternalAuth') ) {
                 
                 # set the attributes that have been defined.
                 foreach my $attribute ($user->WritableAttributes) {
-                    $m->callback( Attribute => $attribute, User => $user, UserInfo => $new_user_info, CallbackName => 'NewUser' );
+                    $m->callback( Attribute => $attribute, User => $user, UserInfo => $new_user_info, CallbackName => 'NewUser', CallbackPage => '/autohandler' );
                     my $method = "Set$attribute";
                     $UserObj->$method( $new_user_info->{$attribute} ) if defined $new_user_info->{$attribute};
                 }
@@ -137,7 +132,7 @@ if ( RT->Config->Get('WebExternalAuth') ) {
         }
 
 		if ( $session{'CurrentUser'}->Id ) {
-            $m->callback(%ARGS, CallbackName => 'ExternalAuthSuccessfulLogin') 
+            $m->callback(%ARGS, CallbackName => 'ExternalAuthSuccessfulLogin', CallbackPage => '/autohandler') 
 		}
         else {
             delete $session{'CurrentUser'};
@@ -167,7 +162,7 @@ if ( RT->Config->Get('WebExternalAuth') ) {
 delete $session{'CurrentUser'} unless $session{'CurrentUser'} && $session{'CurrentUser'}->Id;
 
 # Process per-page authentication callbacks
-$m->callback( %ARGS, CallbackName => 'Auth' );
+$m->callback( %ARGS, CallbackName => 'Auth', CallbackPage => '/autohandler');
 
 delete $session{'CurrentUser'} unless $session{'CurrentUser'} && $session{'CurrentUser'}->Id;
 
@@ -180,12 +175,12 @@ unless( $session{'CurrentUser'} ) {
         unless ( $user_obj->id && $user_obj->IsPassword( $pass ) ) {
             $RT::Logger->error("FAILED LOGIN for $user from $ENV{'REMOTE_ADDR'}");
             $m->comp( '/Elements/Login', %ARGS, Error => loc('Your username or password is incorrect'),);
-            $m->callback( %ARGS, CallbackName => 'FailedLogin' );
+            $m->callback( %ARGS, CallbackName => 'FailedLogin', CallbackPage => '/autohandler');
             $m->abort;
         }
         $session{'CurrentUser'} = $user_obj;
         $RT::Logger->info( "Successful login for $user from $ENV{'REMOTE_ADDR'}");
-        $m->callback( %ARGS, CallbackName => 'SuccessfulLogin' );
+        $m->callback( %ARGS, CallbackName => 'SuccessfulLogin', CallbackPage => '/autohandler' );
     }
     # if no credentials then show him login page
     else {
@@ -198,7 +193,7 @@ unless( $session{'CurrentUser'} ) {
 $session{'home_refresh_interval'} = $ARGS{'HomeRefreshInterval'} if ( $ARGS{'HomeRefreshInterval'} ); 
 
 # Process per-page global callbacks
-$m->callback( %ARGS );
+$m->callback( %ARGS, CallbackName => 'Default', CallbackPage => '/autohandler' );
 RT::Interface::Web::ShowRequestedPage(\%ARGS);
 RT::Interface::Web::LogRecordedSQLStatements();
 $m->comp( '/Elements/Footer', %ARGS );

commit 573d0b24f36ad68b4e4c56a318ea11c4b63e4086
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 30 04:50:31 2009 +0900

    Misordering from RT::Test run

diff --git a/t/ticket/requestor-order.t b/t/ticket/requestor-order.t
index 3a5f99b..4539fbd 100644
--- a/t/ticket/requestor-order.t
+++ b/t/ticket/requestor-order.t
@@ -1,8 +1,8 @@
 #!/usr/bin/perl -w
 use strict; use warnings;
 
-use_ok('RT');
 use RT::Test tests => 58;
+use_ok('RT');
 
 use RT::Ticket;
 

commit 0966ecc1a8a0561c062dbee32e71e92f163f4827
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Wed Sep 30 04:51:29 2009 +0900

    removed inappropriate diag output

diff --git a/t/mail/extractsubjecttag.t b/t/mail/extractsubjecttag.t
index 4f6ee09..5a25488 100644
--- a/t/mail/extractsubjecttag.t
+++ b/t/mail/extractsubjecttag.t
@@ -57,7 +57,6 @@ Subject: [$subject_tag #$ticketid] test
 
 reply with subject tag
 EOF
-    diag($text);
     my ($status, $id) = RT::Test->send_via_mailgate($text, queue => $queue->Name);
     is ($status >> 8, 0, "The mail gateway exited normally");
     is ($id, $ticketid, "Replied to ticket $id correctly");

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


More information about the Rt-commit mailing list