[LON-CAPA-cvs] cvs: loncom /auth lonauth.pm

raeburn raeburn at source.lon-capa.org
Sun Jan 5 06:17:16 EST 2014


raeburn		Sun Jan  5 11:17:16 2014 EDT

  Modified files:              
    /loncom/auth	lonauth.pm 
  Log:
  - Preserve requested role and/or symb from query string when switching user 
    session from load balancer server.
  
  
Index: loncom/auth/lonauth.pm
diff -u loncom/auth/lonauth.pm:1.130 loncom/auth/lonauth.pm:1.131
--- loncom/auth/lonauth.pm:1.130	Sun Jan  5 11:04:27 2014
+++ loncom/auth/lonauth.pm	Sun Jan  5 11:17:16 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # User Authentication Module
 #
-# $Id: lonauth.pm,v 1.130 2014/01/05 11:04:27 raeburn Exp $
+# $Id: lonauth.pm,v 1.131 2014/01/05 11:17:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -471,7 +471,17 @@
         if ($otherserver) {
             &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
                      \%form);
-	    $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl);
+            my $switchto = '/adm/switchserver?otherserver='.$otherserver;
+            if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) {
+                $switchto .= '&origurl='.$firsturl;
+            }
+            if ($form{'role'}) {
+                $switchto .= '&role='.$form{'role'};
+            }
+            if ($form{'symb'}) {
+                $switchto .= '&symb='.$form{'symb'};
+            }
+            $r->internal_redirect($switchto);
         } else {
             $r->print(&noswitch());
         }
@@ -482,7 +492,17 @@
             if ($otherserver) {
                 &success($r,$form{'uname'},$form{'udom'},$authhost,'noredirect',undef,
                          \%form);
-                $r->internal_redirect('/adm/switchserver?otherserver='.$otherserver.'&origurl='.$firsturl);
+                my $switchto = '/adm/switchserver?otherserver='.$otherserver;
+                if (($firsturl) && ($firsturl ne '/adm/switchserver') && ($firsturl ne '/adm/roles')) {
+                    $switchto .= '&origurl='.$firsturl;
+                }
+                if ($form{'role'}) {
+                    $switchto .= '&role='.$form{'role'};
+                }
+                if ($form{'symb'}) {
+                    $switchto .= '&symb='.$form{'symb'};
+                }
+                $r->internal_redirect($switchto);
             } else {
                 $r->print(&noswitch());
             }




More information about the LON-CAPA-cvs mailing list