[Bps-public-commit] r20245 - RT-BugTracker-Public/html/Callbacks/BugTracker-Public/autohandler

ruz at bestpractical.com ruz at bestpractical.com
Tue Dec 29 23:53:14 EST 2009


Author: ruz
Date: Tue Dec 29 23:53:14 2009
New Revision: 20245

Modified:
   RT-BugTracker-Public/html/Callbacks/BugTracker-Public/autohandler/Default

Log:
* redirect Bitcard users to public interface

We can not distinguish public users from authors

Modified: RT-BugTracker-Public/html/Callbacks/BugTracker-Public/autohandler/Default
==============================================================================
--- RT-BugTracker-Public/html/Callbacks/BugTracker-Public/autohandler/Default	(original)
+++ RT-BugTracker-Public/html/Callbacks/BugTracker-Public/autohandler/Default	Tue Dec 29 23:53:14 2009
@@ -46,37 +46,33 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <%init>
-# we don't redirect Bitcard users as those can be authors as well
-if (    $session{'CurrentUser'}->Name eq ($RT::WebPublicUser||'')
-     or defined $session{'CurrentUser'}->{'OpenID'} )
-{
-    # This is a public user, we only want them going to /Public/
-    #
-    # The following logic is very similar to the priv/unpriv logic
-    #
-    my $path = $m->request_comp->path;
+return unless RT::BugTracker::Public->IsPublicUser;
+
+# This is a public user, we only want them going to /Public/
+
+# The following logic is very similar to the priv/unpriv logic
+my $path = $m->request_path;
 
-    # if the user is trying to access a ticket, redirect them
-    if ( $path =~ '^(/+)Ticket/Display.html'
-            and $ARGS{'id'} )
-    {
-        $m->redirect($RT::WebPath . "/Public/Bug/Display.html?id="
-                        . $m->interp->apply_escapes($ARGS{'id'}, 'u'));
-        $m->abort();
-    }
+# if the user is trying to access a ticket, redirect them
+if ( $path =~ '^(/+)Ticket/Display.html'
+        and $ARGS{'id'} )
+{
+    $m->redirect($RT::WebPath . "/Public/Bug/Display.html?id="
+                    . $m->interp->apply_escapes($ARGS{'id'}, 'u'));
+    $m->abort();
+}
 
-    elsif ( $path =~ '^(/+)Dist/Display.html' and $ARGS{'Queue'} ) {
-        $m->redirect($RT::WebPath . "/Public/Dist/Display.html?Name="
-                        . $m->interp->apply_escapes($ARGS{'Queue'}, 'u'));
-    }
+elsif ( $path =~ '^(/+)Dist/Display.html' and $ARGS{'Queue'} ) {
+    $m->redirect($RT::WebPath . "/Public/Dist/Display.html?Name="
+                    . $m->interp->apply_escapes($ARGS{'Queue'}, 'u'));
+}
 
-    # otherwise, drop the user at the Public default page
-    # XXX: don't we want to check against 'NoAuthRegexp' instead???
-    elsif (    $path !~ '^(/+)Public/'
-           and $path !~ '^(/+)NoAuth/'
-           and $path !~ '^(/+)Ticket/Attachment/') {
-        $m->redirect($RT::WebPath . "/Public/");
-        $m->abort();
-    }
+# otherwise, drop the user at the Public default page
+# XXX: don't we want to check against 'NoAuthRegexp' instead???
+elsif (    $path !~ '^(/+)Public/'
+       and $path !~ '^(/+)NoAuth/'
+       and $path !~ '^(/+)Ticket/Attachment/') {
+    $m->redirect($RT::WebPath . "/Public/");
+    $m->abort();
 }
 </%init>



More information about the Bps-public-commit mailing list