version 1.195, 2007/11/15 19:06:28
|
version 1.196, 2007/11/15 21:24:51
|
Line 440 sub print_user_query_page {
|
Line 440 sub print_user_query_page {
|
} |
} |
|
|
sub print_user_modification_page { |
sub print_user_modification_page { |
my ($r,$ccuname,$ccdomain,$srch,$response) = @_; |
my ($r,$ccuname,$ccdomain,$srch,$response,$context) = @_; |
if (($ccuname eq '') || ($ccdomain eq '')) { |
if (($ccuname eq '') || ($ccdomain eq '')) { |
my $usermsg = &mt('No username and/or domain provided.'); |
my $usermsg = &mt('No username and/or domain provided.'); |
&print_username_entry_form($r,$usermsg); |
&print_username_entry_form($r,$usermsg); |
Line 448 sub print_user_modification_page {
|
Line 448 sub print_user_modification_page {
|
} |
} |
my %abv_auth = &auth_abbrev(); |
my %abv_auth = &auth_abbrev(); |
my ($curr_authtype,%rulematch,%inst_results,$curr_kerb_ver,$newuser, |
my ($curr_authtype,%rulematch,%inst_results,$curr_kerb_ver,$newuser, |
%alerts,%curr_rules); |
%alerts,%curr_rules,%got_rules); |
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); |
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain); |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
$newuser = 1; |
$newuser = 1; |
my $checkhash; |
my $checkhash; |
my $checks = { 'username' => 1 }; |
my $checks = { 'username' => 1 }; |
$checkhash->{$ccuname.':'.$ccdomain} = { 'status' => 'new' }; |
$checkhash->{$ccuname.':'.$ccdomain} = { 'newuser' => $newuser }; |
&Apache::loncommon::user_rule_check($checkhash,$checks, |
&Apache::loncommon::user_rule_check($checkhash,$checks, |
\%alerts,\%rulematch,\%inst_results,\%curr_rules); |
\%alerts,\%rulematch,\%inst_results,\%curr_rules,\%got_rules); |
if (ref($alerts{$ccuname.':'.$ccdomain}) eq 'HASH') { |
if (ref($alerts{'username'}) eq 'HASH') { |
if ($alerts{$ccuname.':'.$ccdomain}{'username'}) { |
if (ref($alerts{'username'}{$ccdomain}) eq 'HASH') { |
my $domdesc = |
my $domdesc = |
&Apache::lonnet::domain($ccdomain,'description'); |
&Apache::lonnet::domain($ccdomain,'description'); |
my $userchkmsg; |
if ($alerts{'username'}{$ccdomain}{$ccuname}) { |
if (ref($curr_rules{$ccdomain}) eq 'HASH') { |
my $userchkmsg; |
$userchkmsg = |
if (ref($curr_rules{$ccdomain}) eq 'HASH') { |
&Apache::loncommon::instrule_disallow_msg('username', |
$userchkmsg = |
|
&Apache::loncommon::instrule_disallow_msg('username', |
$domdesc,1). |
$domdesc,1). |
&Apache::loncommon::user_rule_formats($ccdomain, |
&Apache::loncommon::user_rule_formats($ccdomain, |
$domdesc,$curr_rules{$ccdomain}{'username'}, |
$domdesc,$curr_rules{$ccdomain}{'username'}, |
'username'); |
'username'); |
} |
} |
&print_username_entry_form($r,$userchkmsg); |
&print_username_entry_form($r,$userchkmsg); |
return; |
return; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
Line 790 $lt{'hs'}: $home_server_pick
|
Line 792 $lt{'hs'}: $home_server_pick
|
} else { |
} else { |
$r->print($home_server_pick); |
$r->print($home_server_pick); |
} |
} |
|
if ($context eq 'domain') { |
|
$r->print(&Apache::lonuserutils::forceid_change()); |
|
} |
$r->print('</div>'."\n".'<div class="LC_left_float"><h3>'. |
$r->print('</div>'."\n".'<div class="LC_left_float"><h3>'. |
$lt{'lg'}.'</h3>'); |
$lt{'lg'}.'</h3>'); |
my ($fixedauth,$varauth,$authmsg); |
my ($fixedauth,$varauth,$authmsg); |
Line 1585 sub update_user_data {
|
Line 1590 sub update_user_data {
|
my %checkhash; |
my %checkhash; |
my %checks = ('id' => 1); |
my %checks = ('id' => 1); |
%{$checkhash{$env{'form.ccuname'}.':'.$env{'form.ccdomain'}}} = ( |
%{$checkhash{$env{'form.ccuname'}.':'.$env{'form.ccdomain'}}} = ( |
'status' => 'new', |
'newuser' => 1, |
'id' => $env{'form.cid'} |
'id' => $env{'form.cid'}, |
); |
); |
&Apache::loncommon::user_rule_check(\%checkhash,\%checks,\%alerts, |
if ($env{'form.cid'} ne '') { |
\%rulematch,\%inst_results,\%curr_rules); |
&Apache::loncommon::user_rule_check(\%checkhash,\%checks,\%alerts, |
if (ref($alerts{$env{'form.ccuname'}.':'.$env{'form.ccdomain'}}) eq 'HASH') { |
\%rulematch,\%inst_results,\%curr_rules); |
if ($alerts{$env{'form.ccuname'}.':'.$env{'form.ccdomain'}}{'id'}) { |
if (ref($alerts{'id'}) eq 'HASH') { |
my $domdesc = |
if (ref($alerts{'id'}{$env{'form.ccdomain'}}) eq 'HASH') { |
&Apache::lonnet::domain($env{'form.ccdomain'},'description'); |
my $domdesc = |
my $userchkmsg; |
&Apache::lonnet::domain($env{'form.ccdomain'},'description'); |
if (ref($curr_rules{$env{'form.ccdomain'}}) eq 'HASH') { |
if ($alerts{'id'}{$env{'form.ccdomain'}}{$env{'form.cid'}}) { |
$userchkmsg = |
my $userchkmsg; |
&Apache::loncommon::instrule_disallow_msg('id', |
if (ref($curr_rules{$env{'form.ccdomain'}}) eq 'HASH') { |
$domdesc,1). |
$userchkmsg = |
&Apache::loncommon::user_rule_formats($env{'form.ccdomain'}, |
&Apache::loncommon::instrule_disallow_msg('id', |
$domdesc,$curr_rules{$env{'form.ccdomain'}}{'id'},'id'); |
$domdesc,1). |
} |
&Apache::loncommon::user_rule_formats($env{'form.ccdomain'}, |
$r->print($error.&mt('Invalid ID format').$end. |
$domdesc,$curr_rules{$env{'form.ccdomain'}}{'id'},'id'); |
$userchkmsg.$rtnlink); |
} |
return; |
$r->print($error.&mt('Invalid ID format').$end. |
|
$userchkmsg.$rtnlink); |
|
return; |
|
} |
|
} |
} |
} |
} |
} |
# Call modifyuser |
# Call modifyuser |
Line 1644 sub update_user_data {
|
Line 1653 sub update_user_data {
|
# Check for need to change |
# Check for need to change |
my %userenv = &Apache::lonnet::get |
my %userenv = &Apache::lonnet::get |
('environment',['firstname','middlename','lastname','generation', |
('environment',['firstname','middlename','lastname','generation', |
'permanentemail','portfolioquota','inststatus'], |
'id','permanentemail','portfolioquota','inststatus'], |
$env{'form.ccdomain'},$env{'form.ccuname'}); |
$env{'form.ccdomain'},$env{'form.ccuname'}); |
my ($tmp) = keys(%userenv); |
my ($tmp) = keys(%userenv); |
if ($tmp =~ /^(con_lost|error)/i) { |
if ($tmp =~ /^(con_lost|error)/i) { |
%userenv = (); |
%userenv = (); |
} |
} |
# Check to see if we need to change user information |
# Check to see if we need to change user information |
foreach my $item ('firstname','middlename','lastname','generation','permanentemail') { |
foreach my $item ('firstname','middlename','lastname','generation','permanentemail','id') { |
# Strip leading and trailing whitespace |
# Strip leading and trailing whitespace |
$env{'form.c'.$item} =~ s/(\s+$|^\s+)//g; |
$env{'form.c'.$item} =~ s/(\s+$|^\s+)//g; |
} |
} |
|
# Check to see if we can change the ID/student number |
|
my $forceid = $env{'form.forceid'}; |
|
my $recurseid = $env{'form.recurseid'}; |
|
my $newuser = 0; |
|
my $disallowed_id = 0; |
|
my (%alerts,%rulematch,%idinst_results,%curr_rules,%got_rules); |
|
if (!$forceid) { |
|
$env{'form.cid'} = $userenv{'id'}; |
|
} elsif ($env{'form.cid'} ne $userenv{'id'}) { |
|
my $checkhash; |
|
my $checks = { 'id' => 1 }; |
|
$checkhash->{$env{'form.ccuname'}.':'.$env{'form.ccdomain'}} = |
|
{ 'newuser' => $newuser, |
|
'id' => $env{'form.cid'}, |
|
}; |
|
&Apache::loncommon::user_rule_check($checkhash,$checks, |
|
\%alerts,\%rulematch,\%idinst_results,\%curr_rules,\%got_rules); |
|
if (ref($alerts{'id'}) eq 'HASH') { |
|
if (ref($alerts{'id'}{$env{'form.ccdomain'}}) eq 'HASH') { |
|
$disallowed_id = 1; |
|
} |
|
} |
|
} |
my ($quotachanged,$namechanged,$oldportfolioquota,$newportfolioquota, |
my ($quotachanged,$namechanged,$oldportfolioquota,$newportfolioquota, |
$inststatus,$isdefault,$defquotatext); |
$inststatus,$isdefault,$defquotatext); |
my ($defquota,$settingstatus) = |
my ($defquota,$settingstatus) = |
Line 1710 sub update_user_data {
|
Line 1742 sub update_user_data {
|
$env{'form.cmiddlename'} ne $userenv{'middlename'} || |
$env{'form.cmiddlename'} ne $userenv{'middlename'} || |
$env{'form.clastname'} ne $userenv{'lastname'} || |
$env{'form.clastname'} ne $userenv{'lastname'} || |
$env{'form.cgeneration'} ne $userenv{'generation'} || |
$env{'form.cgeneration'} ne $userenv{'generation'} || |
|
$env{'form.cid'} ne $userenv{'id'} || |
$env{'form.cpermanentemail'} ne $userenv{'permanentemail'} )) { |
$env{'form.cpermanentemail'} ne $userenv{'permanentemail'} )) { |
$namechanged = 1; |
$namechanged = 1; |
} |
} |
Line 1719 sub update_user_data {
|
Line 1752 sub update_user_data {
|
$changeHash{'middlename'} = $env{'form.cmiddlename'}; |
$changeHash{'middlename'} = $env{'form.cmiddlename'}; |
$changeHash{'lastname'} = $env{'form.clastname'}; |
$changeHash{'lastname'} = $env{'form.clastname'}; |
$changeHash{'generation'} = $env{'form.cgeneration'}; |
$changeHash{'generation'} = $env{'form.cgeneration'}; |
|
$changeHash{'id'} = $env{'form.cid'}; |
$changeHash{'permanentemail'} = $env{'form.cpermanentemail'}; |
$changeHash{'permanentemail'} = $env{'form.cpermanentemail'}; |
my $putresult = &Apache::lonnet::put |
my $putresult = &Apache::lonnet::put |
('environment',\%changeHash, |
('environment',\%changeHash, |
Line 1731 sub update_user_data {
|
Line 1765 sub update_user_data {
|
'mddl' => "middle", |
'mddl' => "middle", |
'lst' => "last", |
'lst' => "last", |
'gen' => "generation", |
'gen' => "generation", |
|
'id' => "ID/Student number", |
'mail' => "permanent e-mail", |
'mail' => "permanent e-mail", |
'disk' => "disk space allocated to portfolio files", |
'disk' => "disk space allocated to portfolio files", |
'prvs' => "Previous", |
'prvs' => "Previous", |
Line 1744 sub update_user_data {
|
Line 1779 sub update_user_data {
|
<th>$lt{'mddl'}</th> |
<th>$lt{'mddl'}</th> |
<th>$lt{'lst'}</th> |
<th>$lt{'lst'}</th> |
<th>$lt{'gen'}</th> |
<th>$lt{'gen'}</th> |
|
<th>$lt{'id'}</th> |
<th>$lt{'mail'}</th> |
<th>$lt{'mail'}</th> |
<th>$lt{'disk'}</th></tr> |
<th>$lt{'disk'}</th></tr> |
<tr><td>$lt{'prvs'}</td> |
<tr><td>$lt{'prvs'}</td> |
Line 1751 sub update_user_data {
|
Line 1787 sub update_user_data {
|
<td>$userenv{'middlename'} </td> |
<td>$userenv{'middlename'} </td> |
<td>$userenv{'lastname'} </td> |
<td>$userenv{'lastname'} </td> |
<td>$userenv{'generation'} </td> |
<td>$userenv{'generation'} </td> |
|
<td>$userenv{'id'}</td> |
<td>$userenv{'permanentemail'} </td> |
<td>$userenv{'permanentemail'} </td> |
<td>$oldportfolioquota Mb</td> |
<td>$oldportfolioquota Mb</td> |
</tr> |
</tr> |
Line 1759 sub update_user_data {
|
Line 1796 sub update_user_data {
|
<td>$env{'form.cmiddlename'} </td> |
<td>$env{'form.cmiddlename'} </td> |
<td>$env{'form.clastname'} </td> |
<td>$env{'form.clastname'} </td> |
<td>$env{'form.cgeneration'} </td> |
<td>$env{'form.cgeneration'} </td> |
|
<td>$env{'form.cid'} </td> |
<td>$env{'form.cpermanentemail'} </td> |
<td>$env{'form.cpermanentemail'} </td> |
<td>$newportfolioquota Mb $defquotatext </td></tr> |
<td>$newportfolioquota Mb $defquotatext </td></tr> |
</table> |
</table> |
END |
END |
|
if (($forceid) && ($recurseid) && (!$disallowed_id) && |
|
(&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) { |
|
my %userupdate = ( |
|
lastname => $env{'form.clasaname'}, |
|
middlename => $env{'form.cmiddlename'}, |
|
firstname => $env{'form.cfirstname'}, |
|
generation => $env{'fora.cgeneration'}, |
|
id => $env{'form.cid'}, |
|
); |
|
my $idresult = &propagate_id_change($env{'form.ccname'}, |
|
$env{'form.ccdomain'},\%userupdate); |
|
$r->print('<br />'.$idresult.'<br />'); |
|
} |
if (($env{'form.ccdomain'} eq $env{'user.domain'}) && |
if (($env{'form.ccdomain'} eq $env{'user.domain'}) && |
($env{'form.ccuname'} eq $env{'user.name'})) { |
($env{'form.ccuname'} eq $env{'user.name'})) { |
my %newenvhash; |
my %newenvhash; |
Line 1786 END
|
Line 1837 END
|
# They did not want to change the users name but we can |
# They did not want to change the users name but we can |
# still tell them what the name is |
# still tell them what the name is |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
|
'id' => "ID/Student number", |
'mail' => "Permanent e-mail", |
'mail' => "Permanent e-mail", |
'disk' => "Disk space allocated to user's portfolio files", |
'disk' => "Disk space allocated to user's portfolio files", |
); |
); |
$r->print(<<"END"); |
$r->print(<<"END"); |
<h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'} ($lt{'mail'}: $userenv{'permanentemail'})</h4> |
<h4>$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'} |
END |
END |
|
if ($userenv{'permanentemail'} eq '') { |
|
$r->print('</h4>'); |
|
} else { |
|
$r->print(' ('.$lt{'mail'}.': '. |
|
$userenv{'permanentemail'}.')</h4>'); |
|
} |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if ($oldportfolioquota != $newportfolioquota) { |
if ($oldportfolioquota != $newportfolioquota) { |
$r->print('<h4>'.$lt{'disk'}.': '.$newportfolioquota.' Mb '. |
$r->print('<h4>'.$lt{'disk'}.': '.$newportfolioquota.' Mb '. |
Line 1824 END
|
Line 1882 END
|
$env{'form.ccdomain'},$now); |
$env{'form.ccdomain'},$now); |
$r->print($result); |
$r->print($result); |
} |
} |
} |
} |
if ($key=~m{^form\.rev\:([^_]+)_cr\.cr/($match_domain)/($match_username)/(\w+)$}s) { |
if ($key=~m{^form\.rev\:([^_]+)_cr\.cr/($match_domain)/($match_username)/(\w+)$}s) { |
# Revoke custom role |
# Revoke custom role |
$r->print(&mt('Revoking custom role:'). |
$r->print(&mt('Revoking custom role:'). |
Line 2511 sub handler {
|
Line 2569 sub handler {
|
$response = ''; |
$response = ''; |
} |
} |
&print_user_modification_page($r,$ccuname,$ccdomain, |
&print_user_modification_page($r,$ccuname,$ccdomain, |
$srch,$response); |
$srch,$response,$context); |
} elsif ($currstate eq 'query') { |
} elsif ($currstate eq 'query') { |
&print_user_query_page($r,'createuser'); |
&print_user_query_page($r,'createuser'); |
} else { |
} else { |
Line 2521 sub handler {
|
Line 2579 sub handler {
|
} elsif ($env{'form.phase'} eq 'userpicked') { |
} elsif ($env{'form.phase'} eq 'userpicked') { |
my $ccuname = &LONCAPA::clean_username($env{'form.seluname'}); |
my $ccuname = &LONCAPA::clean_username($env{'form.seluname'}); |
my $ccdomain = &LONCAPA::clean_domain($env{'form.seludom'}); |
my $ccdomain = &LONCAPA::clean_domain($env{'form.seludom'}); |
&print_user_modification_page($r,$ccuname,$ccdomain,$srch); |
&print_user_modification_page($r,$ccuname,$ccdomain,$srch,'', |
|
$context); |
} |
} |
} elsif ($env{'form.phase'} eq 'update_user_data') { |
} elsif ($env{'form.phase'} eq 'update_user_data') { |
&update_user_data($r); |
&update_user_data($r); |