--- loncom/auth/migrateuser.pm 2019/06/16 22:27:06 1.45 +++ loncom/auth/migrateuser.pm 2020/03/15 23:04:11 1.46 @@ -1,7 +1,7 @@ # The LearningOnline Network # Starts a user off based of an existing token. # -# $Id: migrateuser.pm,v 1.45 2019/06/16 22:27:06 raeburn Exp $ +# $Id: migrateuser.pm,v 1.46 2020/03/15 23:04:11 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -671,7 +671,7 @@ sub handler { } } - my %form; + my (%form,$cid); if ($data{'symb'} ne '') { $form{'symb'} = $data{'symb'}; } @@ -681,8 +681,13 @@ sub handler { 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'), @@ -915,7 +920,7 @@ sub handler { $r->internal_redirect($next_url); } else { &Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home, - $next_url,$extra_env,\%form); + $next_url,$extra_env,\%form,'',$cid); } return OK; }