[Bps-public-commit] r13181 - RT-BugTracker-Public/html/Public

ruz at bestpractical.com ruz at bestpractical.com
Wed Jun 11 16:53:35 EDT 2008


Author: ruz
Date: Wed Jun 11 16:53:34 2008
New Revision: 13181

Added:
   RT-BugTracker-Public/html/Public/autohandler

Log:
* if the current user is not public/BitCard/OpenId account then
  be smart and redirect him to our private versions

Added: RT-BugTracker-Public/html/Public/autohandler
==============================================================================
--- (empty file)
+++ RT-BugTracker-Public/html/Public/autohandler	Wed Jun 11 16:53:34 2008
@@ -0,0 +1,28 @@
+<%INIT>
+return $m->call_next if
+       !$session{'CurrentUser'} || !$session{'CurrentUser'}->id
+    || $session{'CurrentUser'}->Name eq ($RT::WebPublicUser||'')
+    || defined $session{'BitcardUser'}
+    || defined $session{'CurrentUser'}->{'OpenID'};
+
+$RT::Logger->debug("Not a public user, not BitCard, not Openid. Going to redirect to main URL");
+# This is not a public user
+
+my $public_path = $m->request_comp->path;
+my $new_path = $public_path;
+$new_path =~ s{/+Public/}{/};
+
+# special cases:
+$new_path =~ s{^/Bug/+Display\.html}{/Ticket/Display.html};
+$new_path =~ s{^/Bug/+Report\.html}{/Ticket/Create.html};
+$new_path =~ s{^/Bug/+}{/Ticket/};
+
+# if comp not exist then we just continue and see what will happen
+return $m->call_next unless $m->comp_exists($new_path);
+
+# delete user && password from arguments
+delete @ARGS{'pass', 'user'};
+
+$m->redirect( $RT::WebPath . $new_path . '?'. $m->comp('/Elements/QueryString', %ARGS) );
+$m->abort;
+</%INIT>



More information about the Bps-public-commit mailing list