version 1.78, 2006/06/02 20:22:26
|
version 1.81, 2006/08/30 16:50:23
|
Line 46 my %FORM;
|
Line 46 my %FORM;
|
# ------------------------------------------------------------ Successful login |
# ------------------------------------------------------------ Successful login |
|
|
sub success { |
sub success { |
my ($r, $username, $domain, $authhost,$lowerurl) = @_; |
my ($r, $username, $domain, $authhost, $lowerurl, $extra_env) = @_; |
my $lonids=$r->dir_config('lonIDsDir'); |
my $lonids=$r->dir_config('lonIDsDir'); |
|
|
my $public=($username eq 'public' && $domain eq 'public'); |
my $public=($username eq 'public' && $domain eq 'public'); |
Line 88 sub success {
|
Line 88 sub success {
|
|
|
# Initialize roles |
# Initialize roles |
|
|
$userroles=Apache::lonnet::rolesinit($domain,$username,$authhost); |
$userroles=&Apache::lonnet::rolesinit($domain,$username,$authhost); |
} |
} |
# ------------------------------------ Check browser type and MathML capability |
# ------------------------------------ Check browser type and MathML capability |
|
|
Line 170 sub success {
|
Line 170 sub success {
|
} |
} |
} |
} |
|
|
|
$env{'user.environment'} = "$lonids/$cookie.id"; |
open(my $idf,">$lonids/$cookie.id"); |
open(my $idf,">$lonids/$cookie.id"); |
unless (flock($idf,LOCK_EX)) { |
unless (flock($idf,LOCK_EX)) { |
&Apache::lonnet::logthis("<font color=blue>WARNING: ". |
&Apache::lonnet::logthis("<font color=blue>WARNING: ". |
Line 178 sub success {
|
Line 179 sub success {
|
return 'error: '.$!; |
return 'error: '.$!; |
} |
} |
|
|
while (my ($key,$value) = each(%initial_env)) { |
&add_to_env($idf,\%initial_env); |
print $idf (&escape($key).'='.&escape($value)."\n"); |
&add_to_env($idf,\%userenv); |
} |
&add_to_env($idf,$userroles); |
while (my ($key,$value) = each(%userenv)) { |
&add_to_env($idf,$extra_env); |
print $idf (&escape($key).'='.&escape($value)."\n"); |
|
} |
|
if ($userroles ne '') { print $idf "$userroles"; } |
|
close($idf); |
close($idf); |
} |
} |
$env{'request.role'}='cm'; |
$env{'request.role'}='cm'; |
Line 251 $end_page
|
Line 249 $end_page
|
ENDSUCCESS |
ENDSUCCESS |
} |
} |
|
|
|
sub add_to_env { |
|
my ($idf,$env_data) = @_; |
|
@env{keys(%$env_data)} = @$env_data{keys(%$env_data)}; |
|
while (my ($key,$value) = each(%$env_data)) { |
|
print $idf (&escape($key).'='.&escape($value)."\n"); |
|
} |
|
} |
|
|
# --------------------------------------------------------------- Failed login! |
# --------------------------------------------------------------- Failed login! |
|
|
sub failed { |
sub failed { |
Line 444 ENDFAILED
|
Line 450 ENDFAILED
|
&Apache::lonnet::logthis('Non-privileged user attempting switch user'); |
&Apache::lonnet::logthis('Non-privileged user attempting switch user'); |
} |
} |
} |
} |
&success($r,$FORM{'uname'},$FORM{'udom'},$authhost,$firsturl); |
if ($r->dir_config("lonBalancer") eq 'yes') { |
|
&success($r,$FORM{'uname'},$FORM{'udom'},$authhost,'noredirect'); |
|
$r->internal_redirect('/adm/switchserver'); |
|
} else { |
|
&success($r,$FORM{'uname'},$FORM{'udom'},$authhost,$firsturl); |
|
} |
return OK; |
return OK; |
} |
} |
|
|