[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /auth migrateuser.pm

raeburn raeburn at source.lon-capa.org
Sat May 2 13:35:40 EDT 2020


raeburn		Sat May  2 17:35:40 2020 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/auth	migrateuser.pm 
  Log:
  - For 2.11
    Backport 1.46
  
  
Index: loncom/auth/migrateuser.pm
diff -u loncom/auth/migrateuser.pm:1.25.2.1 loncom/auth/migrateuser.pm:1.25.2.2
--- loncom/auth/migrateuser.pm:1.25.2.1	Thu Aug  1 15:38:36 2019
+++ loncom/auth/migrateuser.pm	Sat May  2 17:35:40 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Starts a user off based of an existing token.
 #
-# $Id: migrateuser.pm,v 1.25.2.1 2019/08/01 15:38:36 raeburn Exp $
+# $Id: migrateuser.pm,v 1.25.2.2 2020/05/02 17:35:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -257,7 +257,7 @@
         }
     }
 
-    my %form;
+    my (%form,$cid);
     if ($data{'symb'} ne '') {
         $form{'symb'} = $data{'symb'};
     }
@@ -267,8 +267,13 @@
     if ($data{'noloadbalance'} ne '') {
         $form{'noloadbalance'} = $data{'noloadbalance'};
     }
-
-    if (!$data{'role'}) {
+    if ($data{'role'}) {
+        if ($data{'role'} =~ m{\./($match_domain)/($match_courseid)(?:/\w+|$)}) {
+            unless (&Apache::lonnet::homeserver($2,$1) eq 'no_host') {
+                $cid = $1.'_'.$2;
+            }
+        }
+    } else {
 	my $handle = &Apache::lonnet::check_for_valid_session($r);
 	if ($handle) {
 	    &Apache::lonnet::transfer_profile_to_env($r->dir_config('lonIDsDir'),
@@ -298,7 +303,7 @@
         $next_url .= '&orgurl='.&escape($data{'origurl'});
     }
     &Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home,
-			      $next_url,$extra_env,\%form);
+			      $next_url,$extra_env,\%form,$cid);
     return OK;
 }
 




More information about the LON-CAPA-cvs mailing list