version 1.160.6.33, 2014/01/06 14:08:31
|
version 1.160.6.34, 2014/02/15 17:07:19
|
Line 95 institutional affiliation in the domain
|
Line 95 institutional affiliation in the domain
|
but is now also used to manage availability of user tools: |
but is now also used to manage availability of user tools: |
i.e., blogs, aboutme page, and portfolios, and the course request tool, |
i.e., blogs, aboutme page, and portfolios, and the course request tool, |
used by course owners to request creation of a course, and to display/store |
used by course owners to request creation of a course, and to display/store |
default quota sizes for authoring spaces. |
default quota sizes for Authoring Spaces. |
|
|
Outputs: 1 |
Outputs: 1 |
|
|
Line 215 sub handler {
|
Line 215 sub handler {
|
'usersessions','loadbalancing','requestauthor'],$dom); |
'usersessions','loadbalancing','requestauthor'],$dom); |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
'autoupdate','autocreate','directorysrch','contacts', |
'autoupdate','autocreate','directorysrch','contacts', |
'usercreation','usermodification','scantron', |
'usercreation','selfcreation','usermodification','scantron', |
'requestcourses','requestauthor','coursecategories', |
'requestcourses','requestauthor','coursecategories', |
'serverstatuses','coursedefaults','usersessions'); |
'serverstatuses','coursedefaults','usersessions'); |
my %existing; |
my %existing; |
Line 293 sub handler {
|
Line 293 sub handler {
|
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
}, |
}, |
|
|
'usercreation' => |
'usercreation' => |
{ text => 'User creation', |
{ text => 'User creation', |
help => 'Domain_Configuration_User_Creation', |
help => 'Domain_Configuration_User_Creation', |
Line 304 sub handler {
|
Line 303 sub handler {
|
{col1 => 'Context', |
{col1 => 'Context', |
col2 => 'Assignable authentication types'}], |
col2 => 'Assignable authentication types'}], |
}, |
}, |
|
'selfcreation' => |
|
{ text => 'Users self-creating accounts', |
|
help => 'Domain_Configuration_Self_Creation', |
|
header => [{col1 => 'Self-creation with institutional username', |
|
col2 => 'Enabled?'}, |
|
{col1 => 'Institutional user type (login/SSO self-creation)', |
|
col2 => 'Information user can enter'}, |
|
{col1 => 'Self-creation with e-mail as username', |
|
col2 => 'Settings'}], |
|
}, |
'usermodification' => |
'usermodification' => |
{ text => 'User modification', |
{ text => 'User modification', |
help => 'Domain_Configuration_User_Modification', |
help => 'Domain_Configuration_User_Modification', |
header => [{col1 => 'Target user has role', |
header => [{col1 => 'Target user has role', |
col2 => 'User information updateable in author context'}, |
col2 => 'User information updateable in author context'}, |
{col1 => 'Target user has role', |
{col1 => 'Target user has role', |
col2 => 'User information updateable in course context'}, |
col2 => 'User information updateable in course context'}], |
{col1 => "Status of user", |
|
col2 => 'Information settable when self-creating account (if directory data blank)'}], |
|
}, |
}, |
'scantron' => |
'scantron' => |
{ text => 'Bubblesheet format file', |
{ text => 'Bubblesheet format file', |
Line 332 sub handler {
|
Line 339 sub handler {
|
col2 => ''}], |
col2 => ''}], |
}, |
}, |
'requestauthor' => |
'requestauthor' => |
{text => 'Request authoring space', |
{text => 'Request Authoring Space', |
help => 'Domain_Configuration_Request_Author', |
help => 'Domain_Configuration_Request_Author', |
header => [{col1 => 'User affiliation', |
header => [{col1 => 'User affiliation', |
col2 => 'Availability/Processing of requests',}, |
col2 => 'Availability/Processing of requests',}, |
Line 522 sub process_changes {
|
Line 529 sub process_changes {
|
$output = &modify_directorysrch($dom,%domconfig); |
$output = &modify_directorysrch($dom,%domconfig); |
} elsif ($action eq 'usercreation') { |
} elsif ($action eq 'usercreation') { |
$output = &modify_usercreation($dom,%domconfig); |
$output = &modify_usercreation($dom,%domconfig); |
|
} elsif ($action eq 'selfcreation') { |
|
$output = &modify_selfcreation($dom,%domconfig); |
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'usermodification') { |
$output = &modify_usermodification($dom,%domconfig); |
$output = &modify_usermodification($dom,%domconfig); |
} elsif ($action eq 'contacts') { |
} elsif ($action eq 'contacts') { |
Line 590 sub print_config_box {
|
Line 599 sub print_config_box {
|
$output .= &print_autoupdate('top',$dom,$settings,\$rowtotal); |
$output .= &print_autoupdate('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'usercreation') { |
} elsif ($action eq 'usercreation') { |
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal); |
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'selfcreation') { |
|
$output .= &print_selfcreation('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'usermodification') { |
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal); |
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
Line 649 sub print_config_box {
|
Line 660 sub print_config_box {
|
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'. |
&print_usercreation('bottom',$dom,$settings,\$rowtotal); |
&print_usercreation('bottom',$dom,$settings,\$rowtotal); |
$rowtotal ++; |
$rowtotal ++; |
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'selfcreation') { |
$output .= &print_usermodification('middle',$dom,$settings,\$rowtotal).' |
$output .= &print_selfcreation('middle',$dom,$settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
</tr> |
</tr> |
Line 659 sub print_config_box {
|
Line 670 sub print_config_box {
|
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td> |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td></tr>'. |
<td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> |
&print_usermodification('bottom',$dom,$settings,\$rowtotal); |
</tr>'. |
|
&print_selfcreation('bottom',$dom,$settings,\$rowtotal); |
$rowtotal ++; |
$rowtotal ++; |
|
} elsif ($action eq 'usermodification') { |
|
$output .= &print_usermodification('middle',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
} elsif ($action eq 'login') { |
} elsif ($action eq 'login') { |
Line 1972 sub print_requestmail {
|
Line 1986 sub print_requestmail {
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'notify'}) eq 'HASH') { |
if (ref($settings->{'notify'}) eq 'HASH') { |
if ($settings->{'notify'}{'approval'} ne '') { |
if ($settings->{'notify'}{'approval'} ne '') { |
map {$currapp{$_}=1;} split(/,/,$settings->{'notify'}{'approval'}); |
map {$currapp{$_}=1;} split(/,/,$settings->{'notify'}{'approval'}); |
} |
} |
} |
} |
} |
} |
my $numinrow = 2; |
my $numinrow = 2; |
my $css_class = 'class="LC_odd_row"'; |
my $css_class; |
|
$css_class = ($$rowtotal%2? ' class="LC_odd_row"':''); |
my $text; |
my $text; |
if ($action eq 'requestcourses') { |
if ($action eq 'requestcourses') { |
$text = &mt('Receive notification of course requests requiring approval'); |
$text = &mt('Receive notification of course requests requiring approval'); |
|
} elsif ($action eq 'requestauthor') { |
|
$text = &mt('Receive notification of Authoring Space requests requiring approval'); |
} else { |
} else { |
$text = &mt('Receive notification of authoring space requests requiring approval') |
$text = &mt('Receive notification of queued requests for self-created user accounts requiring approval'); |
} |
} |
$datatable = '<tr '.$css_class.'>'. |
$datatable = '<tr'.$css_class.'>'. |
' <td>'.$text.'</td>'. |
' <td>'.$text.'</td>'. |
' <td class="LC_left_item">'; |
' <td class="LC_left_item">'; |
my ($numdc,$table,$rows) = &active_dc_picker($dom,$numinrow,'checkbox', |
my ($numdc,$table,$rows) = &active_dc_picker($dom,$numinrow,'checkbox', |
'reqapprovalnotify',%currapp); |
$action.'notifyapproval',%currapp); |
if ($numdc > 0) { |
if ($numdc > 0) { |
$datatable .= $table; |
$datatable .= $table; |
} else { |
} else { |
Line 3631 sub print_usercreation {
|
Line 3648 sub print_usercreation {
|
$rowcount ++; |
$rowcount ++; |
} |
} |
} |
} |
my ($emailrules,$emailruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'email'); |
|
if (ref($emailrules) eq 'HASH') { |
|
if (keys(%{$emailrules}) > 0) { |
|
$datatable .= &user_formats_row('email',$settings,$emailrules, |
|
$emailruleorder,$numinrow,$rowcount); |
|
$$rowtotal ++; |
|
$rowcount ++; |
|
} |
|
} |
|
if ($rowcount == 0) { |
if ($rowcount == 0) { |
$datatable .= '<tr><td colspan="2">'.&mt('No format rules have been defined for usernames or IDs in this domain.').'</td></tr>'; |
$datatable .= '<tr><td colspan="2">'.&mt('No format rules have been defined for usernames or IDs in this domain.').'</td></tr>'; |
$$rowtotal ++; |
$$rowtotal ++; |
$rowcount ++; |
$rowcount ++; |
} |
} |
} elsif ($position eq 'middle') { |
} elsif ($position eq 'middle') { |
my @creators = ('author','course','requestcrs','selfcreate'); |
my @creators = ('author','course','requestcrs'); |
my ($rules,$ruleorder) = |
my ($rules,$ruleorder) = |
&Apache::lonnet::inst_userrules($dom,'username'); |
&Apache::lonnet::inst_userrules($dom,'username'); |
my %lt = &usercreation_types(); |
my %lt = &usercreation_types(); |
my %checked; |
my %checked; |
my @selfcreate; |
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
foreach my $item (@creators) { |
foreach my $item (@creators) { |
$checked{$item} = $settings->{'cancreate'}{$item}; |
$checked{$item} = $settings->{'cancreate'}{$item}; |
} |
} |
if (ref($settings->{'cancreate'}{'selfcreate'}) eq 'ARRAY') { |
|
@selfcreate = @{$settings->{'cancreate'}{'selfcreate'}}; |
|
} elsif ($settings->{'cancreate'}{'selfcreate'} ne '') { |
|
if ($settings->{'cancreate'}{'selfcreate'} eq 'any') { |
|
@selfcreate = ('email','login','sso'); |
|
} elsif ($settings->{'cancreate'}{'selfcreate'} ne 'none') { |
|
@selfcreate = ($settings->{'cancreate'}{'selfcreate'}); |
|
} |
|
} |
|
} elsif (ref($settings->{'cancreate'}) eq 'ARRAY') { |
} elsif (ref($settings->{'cancreate'}) eq 'ARRAY') { |
foreach my $item (@creators) { |
foreach my $item (@creators) { |
if (grep(/^\Q$item\E$/,@{$settings->{'cancreate'}})) { |
if (grep(/^\Q$item\E$/,@{$settings->{'cancreate'}})) { |
Line 3678 sub print_usercreation {
|
Line 3675 sub print_usercreation {
|
my $rownum = 0; |
my $rownum = 0; |
foreach my $item (@creators) { |
foreach my $item (@creators) { |
$rownum ++; |
$rownum ++; |
if ($item ne 'selfcreate') { |
if ($checked{$item} eq '') { |
if ($checked{$item} eq '') { |
$checked{$item} = 'any'; |
$checked{$item} = 'any'; |
|
} |
|
} |
} |
my $css_class; |
my $css_class; |
if ($rownum%2) { |
if ($rownum%2) { |
Line 3692 sub print_usercreation {
|
Line 3687 sub print_usercreation {
|
$datatable .= '<tr'.$css_class.'>'. |
$datatable .= '<tr'.$css_class.'>'. |
'<td><span class="LC_nobreak">'.$lt{$item}. |
'<td><span class="LC_nobreak">'.$lt{$item}. |
'</span></td><td align="right">'; |
'</span></td><td align="right">'; |
my @options; |
my @options = ('any'); |
if ($item eq 'selfcreate') { |
if (ref($rules) eq 'HASH') { |
push(@options,('email','login','sso')); |
if (keys(%{$rules}) > 0) { |
} else { |
push(@options,('official','unofficial')); |
@options = ('any'); |
|
if (ref($rules) eq 'HASH') { |
|
if (keys(%{$rules}) > 0) { |
|
push(@options,('official','unofficial')); |
|
} |
|
} |
} |
push(@options,'none'); |
|
} |
} |
|
push(@options,'none'); |
foreach my $option (@options) { |
foreach my $option (@options) { |
my $type = 'radio'; |
my $type = 'radio'; |
my $check = ' '; |
my $check = ' '; |
if ($item eq 'selfcreate') { |
if ($checked{$item} eq $option) { |
$type = 'checkbox'; |
$check = ' checked="checked" '; |
if (grep(/^\Q$option\E$/,@selfcreate)) { |
|
$check = ' checked="checked" '; |
|
} |
|
} else { |
|
if ($checked{$item} eq $option) { |
|
$check = ' checked="checked" '; |
|
} |
|
} |
} |
$datatable .= '<span class="LC_nobreak"><label>'. |
$datatable .= '<span class="LC_nobreak"><label>'. |
'<input type="'.$type.'" name="can_createuser_'. |
'<input type="'.$type.'" name="can_createuser_'. |
Line 3724 sub print_usercreation {
|
Line 3707 sub print_usercreation {
|
} |
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
} |
} |
my ($othertitle,$usertypes,$types) = |
|
&Apache::loncommon::sorted_inst_types($dom); |
|
my $createsettings; |
|
if (ref($settings) eq 'HASH') { |
|
$createsettings = $settings->{cancreate}; |
|
} |
|
if (ref($usertypes) eq 'HASH') { |
|
if (keys(%{$usertypes}) > 0) { |
|
$datatable .= &insttypes_row($createsettings,$types,$usertypes, |
|
$dom,$numinrow,$othertitle, |
|
'statustocreate'); |
|
$$rowtotal ++; |
|
$rownum ++; |
|
} |
|
} |
|
$datatable .= &captcha_choice('cancreate',$createsettings,$rownum); |
|
} else { |
} else { |
my @contexts = ('author','course','domain'); |
my @contexts = ('author','course','domain'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my @authtypes = ('int','krb4','krb5','loc'); |
Line 3791 sub print_usercreation {
|
Line 3758 sub print_usercreation {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
|
sub print_selfcreation { |
|
my ($position,$dom,$settings,$rowtotal) = @_; |
|
my (@selfcreate,$createsettings,$datatable); |
|
if (ref($settings) eq 'HASH') { |
|
if (ref($settings->{'cancreate'}) eq 'HASH') { |
|
$createsettings = $settings->{'cancreate'}; |
|
if (ref($settings->{'cancreate'}{'selfcreate'}) eq 'ARRAY') { |
|
@selfcreate = @{$settings->{'cancreate'}{'selfcreate'}}; |
|
} elsif ($settings->{'cancreate'}{'selfcreate'} ne '') { |
|
if ($settings->{'cancreate'}{'selfcreate'} eq 'any') { |
|
@selfcreate = ('email','login','sso'); |
|
} elsif ($settings->{'cancreate'}{'selfcreate'} ne 'none') { |
|
@selfcreate = ($settings->{'cancreate'}{'selfcreate'}); |
|
} |
|
} |
|
} |
|
} |
|
my %radiohash; |
|
my $rownum = 0; |
|
my $numinrow = 4; |
|
map { $radiohash{'cancreate_'.$_} = 1; } @selfcreate; |
|
if ($position eq 'top') { |
|
my %choices = &Apache::lonlocal::texthash ( |
|
cancreate_login => 'Institutional Login', |
|
cancreate_sso => 'Institutional Single Sign On', |
|
); |
|
my @toggles = sort(keys(%choices)); |
|
my %defaultchecked = ( |
|
'cancreate_login' => 'off', |
|
'cancreate_sso' => 'off', |
|
); |
|
my $itemcount = 1; |
|
my $onclick; |
|
($datatable,$itemcount) = &radiobutton_prefs(\%radiohash,\@toggles,\%defaultchecked, |
|
\%choices,$itemcount,$onclick); |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
|
|
if (ref($usertypes) eq 'HASH') { |
|
if (keys(%{$usertypes}) > 0) { |
|
$datatable .= &insttypes_row($createsettings,$types,$usertypes, |
|
$dom,$numinrow,$othertitle, |
|
'statustocreate',$rownum); |
|
$rownum ++; |
|
$$rowtotal ++; |
|
} |
|
} |
|
} elsif ($position eq 'middle') { |
|
my %domconf = &Apache::lonnet::get_dom('configuration',['usermodification'],$dom); |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
$usertypes->{'default'} = $othertitle; |
|
if (ref($types) eq 'ARRAY') { |
|
push(@{$types},'default'); |
|
$usertypes->{'default'} = $othertitle; |
|
foreach my $status (@{$types}) { |
|
$rownum ++; |
|
$datatable .= &modifiable_userdata_row('selfcreate',$status,$domconf{'usermodification'}, |
|
$numinrow,$rownum,$usertypes); |
|
$$rowtotal ++; |
|
} |
|
} |
|
} else { |
|
my $css_class = $rownum%2?' class="LC_odd_row"':''; |
|
my %choices = |
|
&Apache::lonlocal::texthash( |
|
email => 'Approved automatically', |
|
emailapproval => 'Queued for approval by DC', |
|
off => 'Not enabled', |
|
); |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td>'.&mt('E-mail address as username'). |
|
'</td><td class="LC_left_item">'. |
|
'<span class="LC_nobreak">'; |
|
foreach my $option ('email','emailapproval','off') { |
|
my $checked; |
|
if ($option eq 'email') { |
|
if ($radiohash{'cancreate_email'}) { |
|
$checked = 'checked="checked"'; |
|
} |
|
} elsif ($option eq 'emailapproval') { |
|
if ($radiohash{'cancreate_emailapproval'}) { |
|
$checked = 'checked="checked"'; |
|
} |
|
} else { |
|
if ((!$radiohash{'cancreate_email'}) && (!$radiohash{'cancreate_emailapproval'})) { |
|
$checked = 'checked="checked"'; |
|
} |
|
} |
|
$datatable .= '<label>'. |
|
'<input type="radio" name="cancreate_email" '. |
|
$checked.' value="'.$option.'" />'. |
|
$choices{$option}.'</label> '; |
|
} |
|
$$rowtotal ++; |
|
$rownum ++; |
|
$datatable .= '</span></td></tr>'. |
|
&print_requestmail($dom,'selfcreation',$createsettings,$rowtotal); |
|
$rownum ++; |
|
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); |
|
$numinrow = 2; |
|
$datatable .= &modifiable_userdata_row('cancreate','emailusername',$settings, |
|
$numinrow,$rownum,undef,$infofields,$infotitles); |
|
$$rowtotal ++; |
|
$rownum ++; |
|
my ($emailrules,$emailruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'email'); |
|
if (ref($emailrules) eq 'HASH') { |
|
if (keys(%{$emailrules}) > 0) { |
|
$datatable .= &user_formats_row('email',$settings,$emailrules, |
|
$emailruleorder,$numinrow,$rownum); |
|
$rownum ++; |
|
$$rowtotal ++; |
|
} |
|
} |
|
$datatable .= &captcha_choice('cancreate',$createsettings,$rownum); |
|
} |
|
return $datatable; |
|
} |
|
|
sub captcha_choice { |
sub captcha_choice { |
my ($context,$settings,$itemcount) = @_; |
my ($context,$settings,$itemcount) = @_; |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext); |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext); |
my %lt = &captcha_phrases(); |
my %lt = &captcha_phrases(); |
$keyentry = 'hidden'; |
$keyentry = 'hidden'; |
if ($context eq 'cancreate') { |
if ($context eq 'cancreate') { |
$rowname = &mt('CAPTCHA validation (e-mail as username)'); |
$rowname = &mt('CAPTCHA validation'); |
} elsif ($context eq 'login') { |
} elsif ($context eq 'login') { |
$rowname = &mt('"Contact helpdesk" CAPTCHA validation'); |
$rowname = &mt('"Contact helpdesk" CAPTCHA validation'); |
} |
} |
Line 3911 sub usercreation_types {
|
Line 3996 sub usercreation_types {
|
author => 'When adding a co-author', |
author => 'When adding a co-author', |
course => 'When adding a user to a course', |
course => 'When adding a user to a course', |
requestcrs => 'When requesting a course', |
requestcrs => 'When requesting a course', |
selfcreate => 'User creates own account', |
|
any => 'Any', |
any => 'Any', |
official => 'Institutional only ', |
official => 'Institutional only ', |
unofficial => 'Non-institutional only', |
unofficial => 'Non-institutional only', |
email => 'E-mail address', |
|
login => 'Institutional Login', |
|
sso => 'SSO', |
|
none => 'None', |
none => 'None', |
); |
); |
return %lt; |
return %lt; |
} |
} |
|
|
|
sub selfcreation_types { |
|
my %lt = &Apache::lonlocal::texthash ( |
|
selfcreate => 'User creates own account', |
|
any => 'Any', |
|
official => 'Institutional only ', |
|
unofficial => 'Non-institutional only', |
|
email => 'E-mail address', |
|
login => 'Institutional Login', |
|
sso => 'SSO', |
|
); |
|
} |
|
|
sub authtype_names { |
sub authtype_names { |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
int => 'Internal', |
int => 'Internal', |
Line 3964 sub print_usermodification {
|
Line 4057 sub print_usermodification {
|
$$rowtotal ++; |
$$rowtotal ++; |
$rowcount ++; |
$rowcount ++; |
} |
} |
} elsif ($position eq 'bottom') { |
|
$context = 'selfcreate'; |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
$usertypes->{'default'} = $othertitle; |
|
if (ref($types) eq 'ARRAY') { |
|
push(@{$types},'default'); |
|
$usertypes->{'default'} = $othertitle; |
|
foreach my $status (@{$types}) { |
|
$datatable .= &modifiable_userdata_row($context,$status,$settings, |
|
$numinrow,$rowcount,$usertypes); |
|
$$rowtotal ++; |
|
$rowcount ++; |
|
} |
|
} |
|
} |
} |
return $datatable; |
return $datatable; |
} |
} |
Line 4758 sub build_category_rows {
|
Line 4837 sub build_category_rows {
|
} |
} |
|
|
sub modifiable_userdata_row { |
sub modifiable_userdata_row { |
my ($context,$role,$settings,$numinrow,$rowcount,$usertypes) = @_; |
my ($context,$role,$settings,$numinrow,$rowcount,$usertypes,$fieldsref,$titlesref) = @_; |
my $rolename; |
my $rolename; |
if ($context eq 'selfcreate') { |
if ($context eq 'cancreate') { |
|
if ($role eq 'emailusername') { |
|
$rolename = &mt('Data user provides'); |
|
} |
|
} elsif ($context eq 'selfcreate') { |
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
$rolename = $usertypes->{$role}; |
$rolename = $usertypes->{$role}; |
} else { |
} else { |
Line 4773 sub modifiable_userdata_row {
|
Line 4856 sub modifiable_userdata_row {
|
$rolename = &Apache::lonnet::plaintext($role); |
$rolename = &Apache::lonnet::plaintext($role); |
} |
} |
} |
} |
my @fields = ('lastname','firstname','middlename','generation', |
my (@fields,%fieldtitles); |
'permanentemail','id'); |
if (ref($fieldsref) eq 'ARRAY') { |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
@fields = @{$fieldsref}; |
|
} else { |
|
@fields = ('lastname','firstname','middlename','generation', |
|
'permanentemail','id'); |
|
} |
|
if ((ref($titlesref) eq 'HASH')) { |
|
%fieldtitles = %{$titlesref}; |
|
} else { |
|
%fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
|
} |
my $output; |
my $output; |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
my $css_class = $rowcount%2?' class="LC_odd_row"':''; |
$output = '<tr '.$css_class.'>'. |
$output = '<tr '.$css_class.'>'. |
Line 4831 sub modifiable_userdata_row {
|
Line 4923 sub modifiable_userdata_row {
|
} |
} |
|
|
sub insttypes_row { |
sub insttypes_row { |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context) = @_; |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context,$rownum) = @_; |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
cansearch => 'Users allowed to search', |
cansearch => 'Users allowed to search', |
statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)', |
statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)', |
Line 4845 sub insttypes_row {
|
Line 4937 sub insttypes_row {
|
if ($context eq 'statustocreate') { |
if ($context eq 'statustocreate') { |
$class = 'LC_right_item'; |
$class = 'LC_right_item'; |
} |
} |
my $output = '<tr class="LC_odd_row">'. |
my $css_class = ' class="LC_odd_row"'; |
'<td>'.$lt{$context}.$showdom. |
if ($rownum ne '') { |
'</td><td class="'.$class.'" colspan="2"><table>'; |
$css_class = ($rownum%2? ' class="LC_odd_row"':''); |
|
} |
|
my $output = '<tr'.$css_class.'>'. |
|
'<td>'.$lt{$context}.$showdom. |
|
'</td><td class="'.$class.'" colspan="2"><table>'; |
my $rem; |
my $rem; |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
for (my $i=0; $i<@{$types}; $i++) { |
for (my $i=0; $i<@{$types}; $i++) { |
Line 6101 sub modify_quotas {
|
Line 6197 sub modify_quotas {
|
} |
} |
} |
} |
if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { |
if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { |
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.reqapprovalnotify'); |
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.'.$context.'notifyapproval'); |
@approvalnotify = sort(@approvalnotify); |
@approvalnotify = sort(@approvalnotify); |
$confhash{'notify'}{'approval'} = join(',',@approvalnotify); |
$confhash{'notify'}{'approval'} = join(',',@approvalnotify); |
my @crstypes = ('official','unofficial','community','textbook'); |
my @crstypes = ('official','unofficial','community','textbook'); |
Line 6445 sub modify_quotas {
|
Line 6541 sub modify_quotas {
|
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |
} |
} |
if (ref($changes{'authorquota'}) eq 'HASH') { |
if (ref($changes{'authorquota'}) eq 'HASH') { |
$resulttext .= '<li>'.&mt('Authoring space default quotas').'<ul>'; |
$resulttext .= '<li>'.&mt('Authoring Space default quotas').'<ul>'; |
foreach my $type (@{$types},'default') { |
foreach my $type (@{$types},'default') { |
if (defined($changes{'authorquota'}{$type})) { |
if (defined($changes{'authorquota'}{$type})) { |
my $typetitle = $usertypes->{$type}; |
my $typetitle = $usertypes->{$type}; |
Line 7328 sub modify_contacts {
|
Line 7424 sub modify_contacts {
|
|
|
sub modify_usercreation { |
sub modify_usercreation { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%curr_usercreation,%changes,%authallowed,%cancreate); |
my ($resulttext,%curr_usercreation,%changes,%authallowed,%cancreate,%save_usercreate); |
my $warningmsg; |
my $warningmsg; |
if (ref($domconfig{'usercreation'}) eq 'HASH') { |
if (ref($domconfig{'usercreation'}) eq 'HASH') { |
foreach my $key (keys(%{$domconfig{'usercreation'}})) { |
foreach my $key (keys(%{$domconfig{'usercreation'}})) { |
$curr_usercreation{$key} = $domconfig{'usercreation'}{$key}; |
if ($key eq 'cancreate') { |
} |
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
} |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule'); |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
my @id_rule = &Apache::loncommon::get_env_multiple('form.id_rule'); |
($item eq 'captcha') || ($item eq 'recaptchakeys')) { |
my @email_rule = &Apache::loncommon::get_env_multiple('form.email_rule'); |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
my @contexts = ('author','course','requestcrs','selfcreate'); |
} else { |
foreach my $item(@contexts) { |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
if ($item eq 'selfcreate') { |
} |
@{$cancreate{$item}} = &Apache::loncommon::get_env_multiple('form.can_createuser_'.$item); |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
|
if (!((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth'))) { |
|
if (ref($cancreate{$item}) eq 'ARRAY') { |
|
if (grep(/^login$/,@{$cancreate{$item}})) { |
|
$warningmsg = &mt('Although account creation has been set to be available for institutional logins, currently default authentication in this domain has not been set to support this.').' '.&mt('You need to set the default authentication type to Kerberos 4 or 5 (with a Kerberos domain specified), or to Local authentication, if the localauth module has been customized in your domain to authenticate institutional logins.'); |
|
} |
} |
} |
} |
|
} elsif ($key eq 'email_rule') { |
|
$save_usercreate{$key} = $domconfig{'usercreation'}{$key}; |
|
} else { |
|
$curr_usercreation{$key} = $domconfig{'usercreation'}{$key}; |
} |
} |
} else { |
|
$cancreate{$item} = $env{'form.can_createuser_'.$item}; |
|
} |
} |
} |
} |
my ($othertitle,$usertypes,$types) = |
my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule'); |
&Apache::loncommon::sorted_inst_types($dom); |
my @id_rule = &Apache::loncommon::get_env_multiple('form.id_rule'); |
if (ref($types) eq 'ARRAY') { |
my @contexts = ('author','course','requestcrs'); |
if (@{$types} > 0) { |
foreach my $item(@contexts) { |
@{$cancreate{'statustocreate'}} = |
$cancreate{$item} = $env{'form.can_createuser_'.$item}; |
&Apache::loncommon::get_env_multiple('form.statustocreate'); |
|
} else { |
|
@{$cancreate{'statustocreate'}} = (); |
|
} |
|
push(@contexts,'statustocreate'); |
|
} |
} |
&process_captcha('cancreate',\%changes,\%cancreate,\%curr_usercreation); |
|
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
foreach my $item (@contexts) { |
foreach my $item (@contexts) { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate')) { |
if ($curr_usercreation{'cancreate'}{$item} ne $cancreate{$item}) { |
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
push(@{$changes{'cancreate'}},$item); |
foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) { |
|
if (ref($cancreate{$item}) eq 'ARRAY') { |
|
if (!grep(/^$curr$/,@{$cancreate{$item}})) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
if ($curr_usercreation{'cancreate'}{$item} eq '') { |
|
if (@{$cancreate{$item}} > 0) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} else { |
|
if ($curr_usercreation{'cancreate'}{$item} eq 'any') { |
|
if (@{$cancreate{$item}} < 3) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} elsif ($curr_usercreation{'cancreate'}{$item} eq 'none') { |
|
if (@{$cancreate{$item}} > 0) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} elsif (!grep(/^$curr_usercreation{'cancreate'}{$item}$/,@{$cancreate{$item}})) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
} |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
foreach my $type (@{$cancreate{$item}}) { |
|
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
|
if (!grep(/^$type$/,@{$curr_usercreation{'cancreate'}{$item}})) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} elsif (($curr_usercreation{'cancreate'}{$item} ne 'any') && |
|
($curr_usercreation{'cancreate'}{$item} ne 'none')) { |
|
if ($curr_usercreation{'cancreate'}{$item} ne $type) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
if ($curr_usercreation{'cancreate'}{$item} ne $cancreate{$item}) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
} |
} |
} |
} elsif (ref($curr_usercreation{'cancreate'}) eq 'ARRAY') { |
} elsif (ref($curr_usercreation{'cancreate'}) eq 'ARRAY') { |
Line 7478 sub modify_usercreation {
|
Line 7506 sub modify_usercreation {
|
push(@{$changes{'id_rule'}},@id_rule); |
push(@{$changes{'id_rule'}},@id_rule); |
} |
} |
|
|
if (ref($curr_usercreation{'email_rule'}) eq 'ARRAY') { |
|
foreach my $type (@{$curr_usercreation{'email_rule'}}) { |
|
if (!grep(/^\Q$type\E$/,@email_rule)) { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
foreach my $type (@email_rule) { |
|
if (!grep(/^\Q$type\E$/,@{$curr_usercreation{'email_rule'}})) { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
} else { |
|
push(@{$changes{'email_rule'}},@email_rule); |
|
} |
|
|
|
my @authen_contexts = ('author','course','domain'); |
my @authen_contexts = ('author','course','domain'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my %authhash; |
my %authhash; |
Line 7523 sub modify_usercreation {
|
Line 7536 sub modify_usercreation {
|
} |
} |
} |
} |
|
|
|
$save_usercreate{'cancreate'}{'course'} = $cancreate{'course'}; |
|
$save_usercreate{'cancreate'}{'author'} = $cancreate{'author'}; |
|
$save_usercreate{'cancreate'}{'requestcrs'} = $cancreate{'requestcrs'}; |
|
$save_usercreate{'id_rule'} = \@id_rule; |
|
$save_usercreate{'username_rule'} = \@username_rule, |
|
$save_usercreate{'authtypes'} = \%authhash; |
|
|
my %usercreation_hash = ( |
my %usercreation_hash = ( |
usercreation => { |
usercreation => \%save_usercreate, |
cancreate => \%cancreate, |
); |
username_rule => \@username_rule, |
|
id_rule => \@id_rule, |
|
email_rule => \@email_rule, |
|
authtypes => \%authhash, |
|
} |
|
); |
|
|
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%usercreation_hash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%usercreation_hash, |
$dom); |
$dom); |
|
|
|
if ($putresult eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
$resulttext = &mt('Changes made:').'<ul>'; |
|
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
|
my %lt = &usercreation_types(); |
|
foreach my $type (@{$changes{'cancreate'}}) { |
|
my $chgtext = $lt{$type}.', '; |
|
if ($cancreate{$type} eq 'none') { |
|
$chgtext .= &mt('creation of new users is not permitted, except by a Domain Coordinator.'); |
|
} elsif ($cancreate{$type} eq 'any') { |
|
$chgtext .= &mt('creation of new users is permitted for both institutional and non-institutional usernames.'); |
|
} elsif ($cancreate{$type} eq 'official') { |
|
$chgtext .= &mt('creation of new users is only permitted for institutional usernames.'); |
|
} elsif ($cancreate{$type} eq 'unofficial') { |
|
$chgtext .= &mt('creation of new users is only permitted for non-institutional usernames.'); |
|
} |
|
$resulttext .= '<li>'.$chgtext.'</li>'; |
|
} |
|
} |
|
if (ref($changes{'username_rule'}) eq 'ARRAY') { |
|
my ($rules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'username'); |
|
my $chgtext = '<ul>'; |
|
foreach my $type (@username_rule) { |
|
if (ref($rules->{$type}) eq 'HASH') { |
|
$chgtext .= '<li>'.$rules->{$type}{'name'}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
if (@username_rule > 0) { |
|
$resulttext .= '<li>'.&mt('Usernames with the following formats are restricted to verified users in the institutional directory: ').$chgtext.'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('There are now no username formats restricted to verified users in the institutional directory.').'</li>'; |
|
} |
|
} |
|
if (ref($changes{'id_rule'}) eq 'ARRAY') { |
|
my ($idrules,$idruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'id'); |
|
my $chgtext = '<ul>'; |
|
foreach my $type (@id_rule) { |
|
if (ref($idrules->{$type}) eq 'HASH') { |
|
$chgtext .= '<li>'.$idrules->{$type}{'name'}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
if (@id_rule > 0) { |
|
$resulttext .= '<li>'.&mt('IDs with the following formats are restricted to verified users in the institutional directory: ').$chgtext.'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('There are now no ID formats restricted to verified users in the institutional directory.').'</li>'; |
|
} |
|
} |
|
my %authname = &authtype_names(); |
|
my %context_title = &context_names(); |
|
if (ref($changes{'authtypes'}) eq 'ARRAY') { |
|
my $chgtext = '<ul>'; |
|
foreach my $type (@{$changes{'authtypes'}}) { |
|
my @allowed; |
|
$chgtext .= '<li><span class="LC_cusr_emph">'.$context_title{$type}.'</span> - '.&mt('assignable authentication types: '); |
|
foreach my $auth (@authtypes) { |
|
if ($authhash{$type}{$auth}) { |
|
push(@allowed,$authname{$auth}); |
|
} |
|
} |
|
if (@allowed > 0) { |
|
$chgtext .= join(', ',@allowed).'</li>'; |
|
} else { |
|
$chgtext .= &mt('none').'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
$resulttext .= '<li>'.&mt('Authentication types available for assignment to new users').'<br />'.$chgtext; |
|
$resulttext .= '</li>'; |
|
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to user creation settings'); |
|
} |
|
} else { |
|
$resulttext = '<span class="LC_error">'. |
|
&mt('An error occurred: [_1]',$putresult).'</span>'; |
|
} |
|
if ($warningmsg ne '') { |
|
$resulttext .= '<br /><span class="LC_warning">'.$warningmsg.'</span><br />'; |
|
} |
|
return $resulttext; |
|
} |
|
|
|
sub modify_selfcreation { |
|
my ($dom,%domconfig) = @_; |
|
my ($resulttext,$warningmsg,%curr_usercreation,%curr_usermodify,%changes,%cancreate); |
|
my (%save_usercreate,%save_usermodify); |
|
# |
|
# Retrieve current domain configuration for self-creation of usernames from $domconfig{'usercreation'}. |
|
# |
|
if (ref($domconfig{'usercreation'}) eq 'HASH') { |
|
foreach my $key (keys(%{$domconfig{'usercreation'}})) { |
|
if ($key eq 'cancreate') { |
|
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
|
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
|
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
|
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
|
($item eq 'emailusername') || ($item eq 'notify')) { |
|
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
|
} else { |
|
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
|
} |
|
} |
|
} |
|
} elsif ($key eq 'email_rule') { |
|
$curr_usercreation{$key} = $domconfig{'usercreation'}{$key}; |
|
} else { |
|
$save_usercreate{$key} = $domconfig{'usercreation'}{$key}; |
|
} |
|
} |
|
} |
|
# |
|
# Retrieve current domain configuration for self-creation of usernames from $domconfig{'usermodification'}. |
|
# |
|
if (ref($domconfig{'usermodification'}) eq 'HASH') { |
|
foreach my $key (keys(%{$domconfig{'usermodification'}})) { |
|
if ($key eq 'selfcreate') { |
|
$curr_usermodify{$key} = $domconfig{'usermodification'}{$key}; |
|
} else { |
|
$save_usermodify{$key} = $domconfig{'usermodification'}{$key}; |
|
} |
|
} |
|
} |
|
|
|
my @contexts = ('selfcreate'); |
|
@{$cancreate{'selfcreate'}} = (); |
|
%{$cancreate{'emailusername'}} = (); |
|
@{$cancreate{'statustocreate'}} = (); |
my %selfcreatetypes = ( |
my %selfcreatetypes = ( |
sso => 'users authenticated by institutional single sign on', |
sso => 'users authenticated by institutional single sign on', |
login => 'users authenticated by institutional log-in', |
login => 'users authenticated by institutional log-in', |
email => 'users who provide a valid e-mail address for use as the username', |
email => 'users who provide a valid e-mail address for use as username (automatic creation)', |
|
emailapproval => 'users who provide a valid e-mail address for use as username (queued for Domain Coordinator review)', |
); |
); |
|
# |
|
# Populate $cancreate{'selfcreate'} array reference with types of user, for which self-creation of user accounts |
|
# is permitted. |
|
# |
|
foreach my $item ('login','sso','email') { |
|
if ($item eq 'email') { |
|
if ($env{'form.cancreate_email'} eq 'email') { |
|
push(@{$cancreate{'selfcreate'}},'email'); |
|
} elsif ($env{'form.cancreate_email'} eq 'emailapproval') { |
|
push(@{$cancreate{'selfcreate'}},'emailapproval'); |
|
} |
|
} else { |
|
if ($env{'form.cancreate_'.$item}) { |
|
push(@{$cancreate{'selfcreate'}},$item); |
|
} |
|
} |
|
} |
|
my (@email_rule,%userinfo,%savecaptcha); |
|
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info(); |
|
# |
|
# Populate $cancreate{'emailusername'} hash ref with information types (if new user will provide data |
|
# value set to one), if self-creation with e-mail address permitted. |
|
# |
|
if (($env{'form.cancreate_email'} eq 'email') || ($env{'form.cancreate_email'} eq 'emailapproval')) { |
|
push(@contexts,'emailusername'); |
|
map { $userinfo{$_} = 1; } &Apache::loncommon::get_env_multiple('form.canmodify_emailusername'); |
|
if (ref($infofields) eq 'ARRAY') { |
|
foreach my $field (@{$infofields}) { |
|
if ($userinfo{$field}) { |
|
$cancreate{'emailusername'}{$field} = 1; |
|
} |
|
} |
|
} |
|
|
|
# |
|
# Populate $cancreate{'notify'} hash ref with names of Domain Coordinators who are to be notified of |
|
# queued requests for self-creation of account using e-mail address as username |
|
# |
|
|
|
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.selfcreationnotifyapproval'); |
|
@approvalnotify = sort(@approvalnotify); |
|
$cancreate{'notify'}{'approval'} = join(',',@approvalnotify); |
|
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
|
if (ref($curr_usercreation{'cancreate'}{'notify'}) eq 'HASH') { |
|
if ($curr_usercreation{'cancreate'}{'notify'}{'approval'} ne $cancreate{'notify'}{'approval'}) { |
|
push(@{$changes{'cancreate'}},'notify'); |
|
} |
|
} else { |
|
if ($cancreate{'notify'}{'approval'}) { |
|
push(@{$changes{'cancreate'}},'notify'); |
|
} |
|
} |
|
} elsif ($cancreate{'notify'}{'approval'}) { |
|
push(@{$changes{'cancreate'}},'notify'); |
|
} |
|
|
|
# |
|
# Retrieve rules (if any) governing types of e-mail address which may be used as a username |
|
# |
|
@email_rule = &Apache::loncommon::get_env_multiple('form.email_rule'); |
|
&process_captcha('cancreate',\%changes,\%savecaptcha,$curr_usercreation{'cancreate'}); |
|
if (ref($curr_usercreation{'email_rule'}) eq 'ARRAY') { |
|
if (@{$curr_usercreation{'email_rule'}} > 0) { |
|
foreach my $type (@{$curr_usercreation{'email_rule'}}) { |
|
if (!grep(/^\Q$type\E$/,@email_rule)) { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
} |
|
if (@email_rule > 0) { |
|
foreach my $type (@email_rule) { |
|
if (!grep(/^\Q$type\E$/,@{$curr_usercreation{'email_rule'}})) { |
|
push(@{$changes{'email_rule'}},$type); |
|
} |
|
} |
|
} |
|
} elsif (@email_rule > 0) { |
|
push(@{$changes{'email_rule'}},@email_rule); |
|
} |
|
} |
|
# |
|
# Check if domain default is set appropriately, if selef-creation of accounts is to be available for |
|
# institutional log-in. |
|
# |
|
if (grep(/^login$/,@{$cancreate{'selfcreate'}})) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); |
|
if (!((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || |
|
($domdefaults{'auth_def'} eq 'localauth'))) { |
|
$warningmsg = &mt('Although account creation has been set to be available for institutional logins, currently default authentication in this domain has not been set to support this.').' '. |
|
&mt('You need to set the default authentication type to Kerberos 4 or 5 (with a Kerberos domain specified), or to Local authentication, if the localauth module has been customized in your domain to authenticate institutional logins.'); |
|
} |
|
} |
|
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
my @fields = ('lastname','firstname','middlename','generation', |
|
'permanentemail','id'); |
|
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
|
# |
|
# Where usernames may created for institutional log-in and/or institutional single sign on: |
|
# (a) populate $cancreate{'statustocreate'} array reference with institutional status types who |
|
# may self-create accounts |
|
# (b) populate $save_usermodify{'selfcreate'} hash reference with status types, and information fields |
|
# which the user may supply, if institutional data is unavailable. |
|
# |
|
if (($env{'form.cancreate_login'}) || ($env{'form.cancreate_sso'})) { |
|
if (ref($types) eq 'ARRAY') { |
|
if (@{$types} > 0) { |
|
@{$cancreate{'statustocreate'}} = &Apache::loncommon::get_env_multiple('form.statustocreate'); |
|
push(@contexts,'statustocreate'); |
|
} else { |
|
undef($cancreate{'statustocreate'}); |
|
} |
|
push(@{$types},'default'); |
|
$usertypes->{'default'} = $othertitle; |
|
foreach my $type (@{$types}) { |
|
my @modifiable = &Apache::loncommon::get_env_multiple('form.canmodify_'.$type); |
|
foreach my $field (@fields) { |
|
if (grep(/^\Q$field\E$/,@modifiable)) { |
|
$save_usermodify{'selfcreate'}{$type}{$field} = 1; |
|
} else { |
|
$save_usermodify{'selfcreate'}{$type}{$field} = 0; |
|
} |
|
} |
|
} |
|
if (ref($curr_usermodify{'selfcreate'}) eq 'HASH') { |
|
foreach my $type (@{$types}) { |
|
if (ref($curr_usermodify{'selfcreate'}{$type}) eq 'HASH') { |
|
foreach my $field (@fields) { |
|
if ($save_usermodify{'selfcreate'}{$type}{$field} ne |
|
$curr_usermodify{'selfcreate'}{$type}{$field}) { |
|
push(@{$changes{'selfcreate'}},$type); |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
foreach my $type (@{$types}) { |
|
push(@{$changes{'selfcreate'}},$type); |
|
} |
|
} |
|
} |
|
} |
|
foreach my $item (@contexts) { |
|
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
|
foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) { |
|
if (ref($cancreate{$item}) eq 'ARRAY') { |
|
if (!grep(/^$curr$/,@{$cancreate{$item}})) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
} |
|
if (ref($cancreate{$item}) eq 'ARRAY') { |
|
foreach my $type (@{$cancreate{$item}}) { |
|
if (!grep(/^$type$/,@{$curr_usercreation{'cancreate'}{$item}})) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
} |
|
} elsif (ref($curr_usercreation{'cancreate'}{$item}) eq 'HASH') { |
|
if (ref($cancreate{$item}) eq 'HASH') { |
|
foreach my $curr (keys(%{$curr_usercreation{'cancreate'}{$item}})) { |
|
if (!$cancreate{$item}{$curr}) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
foreach my $field (keys(%{$cancreate{$item}})) { |
|
if (!$curr_usercreation{'cancreate'}{$item}{$field}) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
} |
|
} elsif ($curr_usercreation{'cancreate'}{$item}) { |
|
if (ref($cancreate{$item}) eq 'ARRAY') { |
|
if (!grep(/^\Q$curr_usercreation{'cancreate'}{$item}\E$/,@{$cancreate{$item}})) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} elsif (ref($cancreate{$item}) eq 'HASH') { |
|
if (!$cancreate{$item}{$curr_usercreation{'cancreate'}{$item}}) { |
|
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
} elsif ($item eq 'emailusername') { |
|
if (keys(%userinfo) > 0) { |
|
push(@{$changes{'cancreate'}},$item); |
|
} |
|
} |
|
} |
|
# |
|
# Populate %save_usercreate hash with updates to self-creation configuration. |
|
# |
|
$save_usercreate{'cancreate'}{'captcha'} = $savecaptcha{'captcha'}; |
|
$save_usercreate{'cancreate'}{'recaptchakeys'} = $savecaptcha{'recaptchakeys'}; |
|
$save_usercreate{'cancreate'}{'selfcreate'} = $cancreate{'selfcreate'}; |
|
if (ref($cancreate{'notify'}) eq 'HASH') { |
|
$save_usercreate{'cancreate'}{'notify'} = $cancreate{'notify'}; |
|
} |
|
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
|
$save_usercreate{'cancreate'}{'statustocreate'} = $cancreate{'statustocreate'}; |
|
} |
|
$save_usercreate{'cancreate'}{'emailusername'} = $cancreate{'emailusername'}; |
|
$save_usercreate{'emailrule'} = \@email_rule; |
|
|
|
my %userconfig_hash = ( |
|
usercreation => \%save_usercreate, |
|
usermodification => \%save_usermodify, |
|
); |
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%userconfig_hash, |
|
$dom); |
|
# |
|
# Accumulate details of changes to domain cofiguration for self-creation of usernames in $resulttext |
|
# |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
my %lt = &usercreation_types(); |
my %lt = &selfcreation_types(); |
foreach my $type (@{$changes{'cancreate'}}) { |
foreach my $type (@{$changes{'cancreate'}}) { |
my $chgtext; |
my $chgtext; |
unless (($type eq 'statustocreate') || ($type eq 'captcha') || ($type eq 'recaptchakeys')) { |
|
$chgtext = $lt{$type}.', '; |
|
} |
|
if ($type eq 'selfcreate') { |
if ($type eq 'selfcreate') { |
if (@{$cancreate{$type}} == 0) { |
if (@{$cancreate{$type}} == 0) { |
$chgtext .= &mt('creation of a new user account is not permitted.'); |
$chgtext .= &mt('Self creation of a new user account is not permitted.'); |
} else { |
} else { |
$chgtext .= &mt('creation of a new account is permitted for:').'<ul>'; |
$chgtext .= &mt('Self-creation of a new account is permitted for:'). |
|
'<ul>'; |
foreach my $case (@{$cancreate{$type}}) { |
foreach my $case (@{$cancreate{$type}}) { |
$chgtext .= '<li>'.$selfcreatetypes{$case}.'</li>'; |
$chgtext .= '<li>'.$selfcreatetypes{$case}.'</li>'; |
} |
} |
Line 7564 sub modify_usercreation {
|
Line 7932 sub modify_usercreation {
|
if (grep(/^(login|sso)$/,@{$cancreate{$type}})) { |
if (grep(/^(login|sso)$/,@{$cancreate{$type}})) { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (@{$cancreate{'statustocreate'}} == 0) { |
if (@{$cancreate{'statustocreate'}} == 0) { |
$chgtext .= '<br /><span class="LC_warning">'.&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.").'</span>'; |
$chgtext .= '<br />'. |
|
'<span class="LC_warning">'. |
|
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."). |
|
'</span>'; |
} |
} |
} |
} |
} |
} |
Line 7575 sub modify_usercreation {
|
Line 7946 sub modify_usercreation {
|
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
if (@{$cancreate{'selfcreate'}} > 0) { |
if (@{$cancreate{'selfcreate'}} > 0) { |
if (@{$cancreate{'statustocreate'}} == 0) { |
if (@{$cancreate{'statustocreate'}} == 0) { |
|
|
$chgtext .= &mt("Institutional affiliations permitted to create accounts set to 'None'."); |
$chgtext .= &mt("Institutional affiliations permitted to create accounts set to 'None'."); |
if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) { |
if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) { |
$chgtext .= '<br /><span class="LC_warning">'.&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.").'</span>'; |
$chgtext .= '<br />'. |
} |
'<span class="LC_warning">'. |
|
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."). |
|
'</span>'; |
|
} |
} elsif (ref($usertypes) eq 'HASH') { |
} elsif (ref($usertypes) eq 'HASH') { |
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
$chgtext .= &mt('Creation of a new account for an institutional user is restricted to the following institutional affiliation(s):'); |
$chgtext .= &mt('Creation of a new account for an institutional user is restricted to the following institutional affiliation(s):'); |
Line 7596 sub modify_usercreation {
|
Line 7969 sub modify_usercreation {
|
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
$chgtext .= '<br /><span class="LC_warning">'.&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.').'</span>'; |
$chgtext .= '<br /><span class="LC_warning">'. |
|
&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.'). |
|
'</span>'; |
} |
} |
} |
} |
} else { |
} else { |
Line 7608 sub modify_usercreation {
|
Line 7983 sub modify_usercreation {
|
} |
} |
} |
} |
} elsif ($type eq 'captcha') { |
} elsif ($type eq 'captcha') { |
if ($cancreate{$type} eq 'notused') { |
if ($savecaptcha{$type} eq 'notused') { |
$chgtext .= &mt('No CAPTCHA validation in use for self-creation screen.'); |
$chgtext .= &mt('No CAPTCHA validation in use for self-creation screen.'); |
} else { |
} else { |
my %captchas = &captcha_phrases(); |
my %captchas = &captcha_phrases(); |
if ($captchas{$cancreate{$type}}) { |
if ($captchas{$savecaptcha{$type}}) { |
$chgtext .= &mt("Validation for self-creation screen set to $captchas{$cancreate{$type}}."); |
$chgtext .= &mt("Validation for self-creation screen set to $captchas{$savecaptcha{$type}}."); |
} else { |
} else { |
$chgtext .= &mt('Validation for self-creation screen set to unknown type.'); |
$chgtext .= &mt('Validation for self-creation screen set to unknown type.'); |
} |
} |
} |
} |
} elsif ($type eq 'recaptchakeys') { |
} elsif ($type eq 'recaptchakeys') { |
my ($privkey,$pubkey); |
my ($privkey,$pubkey); |
if (ref($cancreate{$type}) eq 'HASH') { |
if (ref($savecaptcha{$type}) eq 'HASH') { |
$pubkey = $cancreate{$type}{'public'}; |
$pubkey = $savecaptcha{$type}{'public'}; |
$privkey = $cancreate{$type}{'private'}; |
$privkey = $savecaptcha{$type}{'private'}; |
} |
} |
$chgtext .= &mt('ReCAPTCHA keys changes').'<ul>'; |
$chgtext .= &mt('ReCAPTCHA keys changes').'<ul>'; |
if (!$pubkey) { |
if (!$pubkey) { |
Line 7636 sub modify_usercreation {
|
Line 8011 sub modify_usercreation {
|
$chgtext .= '<li>'.&mt('Private key set to [_1]',$pubkey).'</li>'; |
$chgtext .= '<li>'.&mt('Private key set to [_1]',$pubkey).'</li>'; |
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
} else { |
} elsif ($type eq 'emailusername') { |
if ($cancreate{$type} eq 'none') { |
if (ref($cancreate{'emailusername'}) eq 'HASH') { |
$chgtext .= &mt('creation of new users is not permitted, except by a Domain Coordinator.'); |
if (keys(%{$cancreate{'emailusername'}}) > 0) { |
} elsif ($cancreate{$type} eq 'any') { |
$chgtext .= &mt('When self-creating account with e-mail as username, user will provide the following information:'). |
$chgtext .= &mt('creation of new users is permitted for both institutional and non-institutional usernames.'); |
'<ul>'; |
} elsif ($cancreate{$type} eq 'official') { |
foreach my $field (@{$infofields}) { |
$chgtext .= &mt('creation of new users is only permitted for institutional usernames.'); |
if ($cancreate{'emailusername'}{$field}) { |
} elsif ($cancreate{$type} eq 'unofficial') { |
$chgtext .= '<li>'.$infotitles->{$field}.'</li>'; |
$chgtext .= &mt('creation of new users is only permitted for non-institutional usernames.'); |
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} else { |
|
$chgtext .= &mt('When self creating account with e-mail as username, user will not provide any information besides e-mail address'); |
|
} |
|
} |
|
} elsif ($type eq 'notify') { |
|
$chgtext = &mt('No Domain Coordinators will receive notification of username requests requiring approval.'); |
|
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
|
if ((grep(/^notify$/,@{$changes{'cancreate'}})) && (ref($cancreate{'notify'}) eq 'HASH')) { |
|
if ($cancreate{'notify'}{'approval'}) { |
|
$chgtext = &mt('Notification of username requests requiring approval will be sent to: ').$cancreate{'notify'}{'approval'}; |
|
} |
|
} |
} |
} |
} |
} |
$resulttext .= '<li>'.$chgtext.'</li>'; |
if ($chgtext) { |
} |
$resulttext .= '<li>'.$chgtext.'</li>'; |
} |
|
if (ref($changes{'username_rule'}) eq 'ARRAY') { |
|
my ($rules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'username'); |
|
my $chgtext = '<ul>'; |
|
foreach my $type (@username_rule) { |
|
if (ref($rules->{$type}) eq 'HASH') { |
|
$chgtext .= '<li>'.$rules->{$type}{'name'}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
if (@username_rule > 0) { |
|
$resulttext .= '<li>'.&mt('Usernames with the following formats are restricted to verified users in the institutional directory: ').$chgtext.'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('There are now no username formats restricted to verified users in the institutional directory.').'</li>'; |
|
} |
|
} |
|
if (ref($changes{'id_rule'}) eq 'ARRAY') { |
|
my ($idrules,$idruleorder) = |
|
&Apache::lonnet::inst_userrules($dom,'id'); |
|
my $chgtext = '<ul>'; |
|
foreach my $type (@id_rule) { |
|
if (ref($idrules->{$type}) eq 'HASH') { |
|
$chgtext .= '<li>'.$idrules->{$type}{'name'}.'</li>'; |
|
} |
} |
} |
} |
$chgtext .= '</ul>'; |
|
if (@id_rule > 0) { |
|
$resulttext .= '<li>'.&mt('IDs with the following formats are restricted to verified users in the institutional directory: ').$chgtext.'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('There are now no ID formats restricted to verified users in the institutional directory.').'</li>'; |
|
} |
|
} |
} |
if (ref($changes{'email_rule'}) eq 'ARRAY') { |
if (ref($changes{'email_rule'}) eq 'ARRAY') { |
my ($emailrules,$emailruleorder) = |
my ($emailrules,$emailruleorder) = |
Line 7693 sub modify_usercreation {
|
Line 8052 sub modify_usercreation {
|
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
if (@email_rule > 0) { |
if (@email_rule > 0) { |
$resulttext .= '<li>'.&mt('Accounts may not be created by users self-enrolling with e-mail addresses of the following types: ').$chgtext.'</li>'; |
$resulttext .= '<li>'. |
|
&mt('Accounts may not be created by users self-enrolling with e-mail addresses of the following types: '). |
|
$chgtext. |
|
'</li>'; |
} else { |
} else { |
$resulttext .= '<li>'.&mt('There are now no restrictions on e-mail addresses which may be used as a username when self-enrolling.').'</li>'; |
$resulttext .= '<li>'. |
|
&mt('There are now no restrictions on e-mail addresses which may be used as a username when self-enrolling.'). |
|
'</li>'; |
} |
} |
} |
} |
|
if (ref($changes{'selfcreate'}) eq 'ARRAY') { |
my %authname = &authtype_names(); |
$resulttext .= '<li>'.&mt('When self-creating institutional account:').'<ul>'; |
my %context_title = &context_names(); |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
if (ref($changes{'authtypes'}) eq 'ARRAY') { |
foreach my $type (@{$changes{'selfcreate'}}) { |
my $chgtext = '<ul>'; |
my $typename = $type; |
foreach my $type (@{$changes{'authtypes'}}) { |
if (ref($usertypes) eq 'HASH') { |
my @allowed; |
if ($usertypes->{$type} ne '') { |
$chgtext .= '<li><span class="LC_cusr_emph">'.$context_title{$type}.'</span> - '.&mt('assignable authentication types: '); |
$typename = $usertypes->{$type}; |
foreach my $auth (@authtypes) { |
|
if ($authhash{$type}{$auth}) { |
|
push(@allowed,$authname{$auth}); |
|
} |
} |
} |
} |
if (@allowed > 0) { |
my @modifiable; |
$chgtext .= join(', ',@allowed).'</li>'; |
$resulttext .= '<li>'. |
|
&mt('Self-creation of account by users with status: [_1]', |
|
'<span class="LC_cusr_emph">'.$typename.'</span>'). |
|
' - '.&mt('modifiable fields (if institutional data blank): '); |
|
foreach my $field (@fields) { |
|
if ($save_usermodify{'selfcreate'}{$type}{$field}) { |
|
push(@modifiable,'<b>'.$fieldtitles{$field}.'</b>'); |
|
} |
|
} |
|
if (@modifiable > 0) { |
|
$resulttext .= join(', ',@modifiable); |
} else { |
} else { |
$chgtext .= &mt('none').'</li>'; |
$resulttext .= &mt('none'); |
} |
} |
|
$resulttext .= '</li>'; |
} |
} |
$chgtext .= '</ul>'; |
$resulttext .= '</ul></li>'; |
$resulttext .= '<li>'.&mt('Authentication types available for assignment to new users').'<br />'.$chgtext; |
|
$resulttext .= '</li>'; |
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = &mt('No changes made to user creation settings'); |
$resulttext = &mt('No changes made to self-creation settings'); |
} |
} |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
Line 7790 sub process_captcha {
|
Line 8160 sub process_captcha {
|
|
|
sub modify_usermodification { |
sub modify_usermodification { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%curr_usermodification,%changes); |
my ($resulttext,%curr_usermodification,%changes,%modifyhash); |
if (ref($domconfig{'usermodification'}) eq 'HASH') { |
if (ref($domconfig{'usermodification'}) eq 'HASH') { |
foreach my $key (keys(%{$domconfig{'usermodification'}})) { |
foreach my $key (keys(%{$domconfig{'usermodification'}})) { |
$curr_usermodification{$key} = $domconfig{'usermodification'}{$key}; |
if ($key eq 'selfcreate') { |
|
$modifyhash{$key} = $domconfig{'usermodification'}{$key}; |
|
} else { |
|
$curr_usermodification{$key} = $domconfig{'usermodification'}{$key}; |
|
} |
} |
} |
} |
} |
my @contexts = ('author','course','selfcreate'); |
my @contexts = ('author','course'); |
my %context_title = ( |
my %context_title = ( |
author => 'In author context', |
author => 'In author context', |
course => 'In course context', |
course => 'In course context', |
selfcreate => 'When self creating account', |
|
); |
); |
my @fields = ('lastname','firstname','middlename','generation', |
my @fields = ('lastname','firstname','middlename','generation', |
'permanentemail','id'); |
'permanentemail','id'); |
Line 7808 sub modify_usermodification {
|
Line 8181 sub modify_usermodification {
|
author => ['ca','aa'], |
author => ['ca','aa'], |
course => ['st','ep','ta','in','cr'], |
course => ['st','ep','ta','in','cr'], |
); |
); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
|
if (ref($types) eq 'ARRAY') { |
|
push(@{$types},'default'); |
|
$usertypes->{'default'} = $othertitle; |
|
} |
|
$roles{'selfcreate'} = $types; |
|
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %modifyhash; |
|
foreach my $context (@contexts) { |
foreach my $context (@contexts) { |
foreach my $role (@{$roles{$context}}) { |
foreach my $role (@{$roles{$context}}) { |
my @modifiable = &Apache::loncommon::get_env_multiple('form.canmodify_'.$role); |
my @modifiable = &Apache::loncommon::get_env_multiple('form.canmodify_'.$role); |
Line 7861 sub modify_usermodification {
|
Line 8227 sub modify_usermodification {
|
if (ref($changes{$context}) eq 'ARRAY') { |
if (ref($changes{$context}) eq 'ARRAY') { |
foreach my $role (@{$changes{$context}}) { |
foreach my $role (@{$changes{$context}}) { |
my $rolename; |
my $rolename; |
if ($context eq 'selfcreate') { |
if ($role eq 'cr') { |
$rolename = $role; |
$rolename = &mt('Custom'); |
if (ref($usertypes) eq 'HASH') { |
|
if ($usertypes->{$role} ne '') { |
|
$rolename = $usertypes->{$role}; |
|
} |
|
} |
|
} else { |
} else { |
if ($role eq 'cr') { |
$rolename = &Apache::lonnet::plaintext($role); |
$rolename = &mt('Custom'); |
|
} else { |
|
$rolename = &Apache::lonnet::plaintext($role); |
|
} |
|
} |
} |
my @modifiable; |
my @modifiable; |
if ($context eq 'selfcreate') { |
$resulttext .= '<li><span class="LC_cusr_emph">'.&mt('Target user with [_1] role',$rolename).'</span> - '.&mt('modifiable fields: '); |
$resulttext .= '<li><span class="LC_cusr_emph">'.&mt('Self-creation of account by users with status: [_1]',$rolename).'</span> - '.&mt('modifiable fields (if institutional data blank): '); |
|
} else { |
|
$resulttext .= '<li><span class="LC_cusr_emph">'.&mt('Target user with [_1] role',$rolename).'</span> - '.&mt('modifiable fields: '); |
|
} |
|
foreach my $field (@fields) { |
foreach my $field (@fields) { |
if ($modifyhash{$context}{$role}{$field}) { |
if ($modifyhash{$context}{$role}{$field}) { |
push(@modifiable,$fieldtitles{$field}); |
push(@modifiable,$fieldtitles{$field}); |