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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 15 Sep 2008 19:08:44 -0000


raeburn		Mon Sep 15 15:08:44 2008 EDT

  Modified files:              
    /loncom/auth	lonacc.pm migrateuser.pm 
  Log:
  - Incoming users authenticated by SSO may not always need to go to the roles screen.
  - Add the following to a <Location $url> directive in loncapa_apache_conf:
  PerlSetVar      ssodirecturl 1
  for authenticated SSO users to go to $url after session initialization.
  
  
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.115 loncom/auth/lonacc.pm:1.116
--- loncom/auth/lonacc.pm:1.115	Wed May 14 14:27:30 2008
+++ loncom/auth/lonacc.pm	Mon Sep 15 15:08:44 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.115 2008/05/14 18:27:30 raeburn Exp $
+# $Id: lonacc.pm,v 1.116 2008/09/15 19:08:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -187,6 +187,9 @@
 		      'server'    => $r->dir_config('lonHostID'),
 		      'sso.login' => 1
 		      );
+            if ($r->dir_config("ssodirecturl") == 1) {
+                $info{'origurl'} = $r->uri;
+            }
             if (defined($r->dir_config("lonSSOReloginServer"))) {
                 $info{'sso.reloginserver'} = 
                     $r->dir_config('lonSSOReloginServer'); 
@@ -239,7 +242,7 @@
 
     my $result = &sso_login($r,$handle);
     if (defined($result)) {
-	return $result
+	return $result;
     }
 
 
Index: loncom/auth/migrateuser.pm
diff -u loncom/auth/migrateuser.pm:1.13 loncom/auth/migrateuser.pm:1.14
--- loncom/auth/migrateuser.pm:1.13	Mon Mar 24 00:56:07 2008
+++ loncom/auth/migrateuser.pm	Mon Sep 15 15:08:44 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Starts a user off based of an existing token.
 #
-# $Id: migrateuser.pm,v 1.13 2008/03/24 04:56:07 raeburn Exp $
+# $Id: migrateuser.pm,v 1.14 2008/09/15 19:08:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -94,14 +94,20 @@
 	if ($handle) {
 	    &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'),
 						     $handle);
-	    if ($env{'request.course.id'}) {
-		$r->internal_redirect('/adm/navmaps');
+            if ($data{'origurl'} ne '') {
+                $r->internal_redirect($data{'origurl'});
+            } elsif ($env{'request.course.id'}) {
+                $r->internal_redirect('/adm/navmaps');
 	    } else {
 		$r->internal_redirect('/adm/roles');
 	    }
 	} else {
+            my $desturl = '/adm/roles';
+            if ($data{'origurl'} ne '') {
+                $desturl = $data{'origurl'};
+            }
 	    &Apache::lonauth::success($r,$data{'username'},$data{'domain'},
-				      $home,'/adm/roles',$extra_env);
+				      $home,$desturl,$extra_env);
 
 	}
 	return OK;