--- loncom/interface/domainprefs.pm 2017/01/23 23:50:11 1.289
+++ loncom/interface/domainprefs.pm 2017/05/09 03:04:26 1.297
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.289 2017/01/23 23:50:11 raeburn Exp $
+# $Id: domainprefs.pm,v 1.297 2017/05/09 03:04:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,7 +27,7 @@
#
#
###############################################################
-##############################################################
+###############################################################
=pod
@@ -220,6 +220,19 @@ sub handler {
'coursedefaults','usersessions','loadbalancing',
'requestauthor','selfenrollment','inststatus',
'ltitools','ssl','trust'],$dom);
+ if (ref($domconfig{'ltitools'}) eq 'HASH') {
+ my %encconfig =
+ &Apache::lonnet::get_dom('encconfig',['ltitools'],$dom);
+ if (ref($encconfig{'ltitools'}) eq 'HASH') {
+ foreach my $id (keys(%{$domconfig{'ltitools'}})) {
+ if (ref($domconfig{'ltitools'}{$id}) eq 'HASH') {
+ foreach my $item ('key','secret') {
+ $domconfig{'ltitools'}{$id}{$item} = $encconfig{'ltitools'}{$id}{$item};
+ }
+ }
+ }
+ }
+ }
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','selfcreation','usermodification','scantron',
@@ -265,6 +278,8 @@ sub handler {
help => 'Domain_Configuration_LangTZAuth',
header => [{col1 => 'Setting',
col2 => 'Value'},
+ {col1 => 'Internal Authentication',
+ col2 => 'Value'},
{col1 => 'Institutional user types',
col2 => 'Assignable to e-mail usernames'}],
print => \&print_defaults,
@@ -486,7 +501,7 @@ sub handler {
},
'ltitools' =>
{text => 'External Tools (LTI)',
- help => 'Domain_configuration_LTI_Tools',
+ help => 'Domain_Configuration_LTI_Tools',
header => [{col1 => 'Setting',
col2 => 'Value',}],
print => \&print_ltitools,
@@ -499,6 +514,8 @@ sub handler {
col2 => 'Certificate Status'},
{col1 => 'Connections to other servers',
col2 => 'Rules'},
+ {col1 => 'Connections from other servers',
+ col2 => 'Rules'},
{col1 => "Replicating domain's published content",
col2 => 'Rules'}],
print => \&print_ssl,
@@ -673,7 +690,7 @@ sub process_changes {
} elsif ($action eq 'autocreate') {
$output = &modify_autocreate($dom,%domconfig);
} elsif ($action eq 'directorysrch') {
- $output = &modify_directorysrch($dom,%domconfig);
+ $output = &modify_directorysrch($dom,$lastactref,%domconfig);
} elsif ($action eq 'usercreation') {
$output = &modify_usercreation($dom,%domconfig);
} elsif ($action eq 'selfcreation') {
@@ -806,7 +823,7 @@ sub print_config_box {
if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
($action eq 'usersessions') || ($action eq 'coursecategories') ||
- ($action eq 'ssl') || ($action eq 'trust') || ($action eq 'contacts')) {
+ ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults')) {
if ($action eq 'coursecategories') {
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
$colspan = ' colspan="2"';
@@ -866,6 +883,28 @@ sub print_config_box {
($action eq 'defaults') || ($action eq 'directorysrch') ||
($action eq 'helpsettings')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
+ } elsif ($action eq 'ssl') {
+ $output .= $item->{'print'}->('connto',$dom,$settings,\$rowtotal).'
+
+
+
+
+
+
+
+ '.&mt($item->{'header'}->[2]->{'col1'}).' |
+ '.&mt($item->{'header'}->[2]->{'col2'}).' | '.
+ $item->{'print'}->('connfrom',$dom,$settings,\$rowtotal).'
+
+ |
+
+
+
+
+
+ '.&mt($item->{'header'}->[3]->{'col1'}).' |
+ '.&mt($item->{'header'}->[3]->{'col2'}).' | '.
+ $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 4) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -3250,7 +3289,7 @@ sub print_helpsettings {
my $context = 'domprefs';
my $crstype = 'Course';
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- my @accesstypes = ('all','none');
+ my @accesstypes = ('all','dh','da','none');
my ($numstatustypes,@jsarray);
if (ref($types) eq 'ARRAY') {
if (@{$types} > 0) {
@@ -3259,7 +3298,7 @@ sub print_helpsettings {
@jsarray = ('bystatus');
}
}
- my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh']);
+ my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh','da']);
if (keys(%domhelpdesk)) {
push(@accesstypes,('inc','exc'));
push(@jsarray,('notinc','notexc'));
@@ -3468,7 +3507,7 @@ function helpdeskAccess(num) {
shown = Array('notinc');
hidden = Array('notexc','bystatus');
}
- if (curraccess == 'all') {
+ if ((curraccess == 'all') || (curraccess == 'dh') || (curraccess == 'da')) {
hidden = Array('notinc','notexc','bystatus');
}
}
@@ -3525,7 +3564,9 @@ sub helpdeskroles_access {
my %lt = &Apache::lonlocal::texthash(
'rou' => 'Role usage',
'whi' => 'Which helpdesk personnel may use this role?',
- 'all' => 'All',
+ 'all' => 'All with domain helpdesk or helpdesk assistant role',
+ 'dh' => 'All with domain helpdesk role',
+ 'da' => 'All with domain helpdesk assistant role',
'none' => 'None',
'status' => 'Determined based on institutional status',
'inc' => 'Include all, but exclude specific personnel',
@@ -3726,6 +3767,8 @@ sub print_ltitools {
if ($settings->{$item}->{'display'}->{'height'} =~ /^(\d+)$/) {
$currdisp{'height'} = $1;
}
+ $currdisp{'linktext'} = $settings->{$item}->{'display'}->{'linktext'};
+ $currdisp{'explanation'} = $settings->{$item}->{'display'}->{'explanation'};
} else {
$currdisp{'iframe'} = ' checked="checked"';
}
@@ -3739,6 +3782,12 @@ sub print_ltitools {
''.
(' 'x2);
}
+ $datatable .= ' '.
+ ''.$lt{'linktext'}.' '.
+ ' '.
+ ''.$lt{'explanation'}.' '.
+ ' ';
$datatable .= ' ';
foreach my $extra ('passback','roster') {
my $checkedon = '';
@@ -3820,7 +3869,7 @@ sub print_ltitools {
}
}
$datatable .= ' '.
''.
' | ';
}
$datatable .= '
'."\n";
$itemcount ++;
@@ -4655,7 +4713,32 @@ sub print_ssl {
my @domservers = &Apache::lonnet::get_servers($dom);
my %servers = &Apache::lonnet::internet_dom_servers($dom);
my %altids = &id_for_thisdom(%servers);
- if ($position eq 'middle') {
+ if (($position eq 'connto') || ($position eq 'connfrom')) {
+ my $legacy;
+ unless (ref($settings) eq 'HASH') {
+ my $name;
+ if ($position eq 'connto') {
+ $name = 'loncAllowInsecure';
+ } else {
+ $name = 'londAllowInsecure';
+ }
+ my $primarylibserv = &Apache::lonnet::domain($dom,'primary');
+ my @ids=&Apache::lonnet::current_machine_ids();
+ if (($primarylibserv ne '') && (!grep(/^\Q$primarylibserv\E$/,@ids))) {
+ my %what = (
+ $name => 1,
+ );
+ my ($result,$returnhash) =
+ &Apache::lonnet::get_remote_globals($primarylibserv,\%what);
+ if ($result eq 'ok') {
+ if (ref($returnhash) eq 'HASH') {
+ $legacy = $returnhash->{$name};
+ }
+ }
+ } else {
+ $legacy = $Apache::lonnet::perlvar{$name};
+ }
+ }
foreach my $type ('dom','intdom','other') {
my %checked;
$css_class = $itemcount%2?' class="LC_odd_row"':'';
@@ -4682,16 +4765,21 @@ sub print_ssl {
unless ($skip) {
$checked{'yes'} = ' checked="checked"';
if (ref($settings) eq 'HASH') {
- if (ref($settings->{'connect'}) eq 'HASH') {
- if ($settings->{'connect'}->{$type} =~ /^(no|req)$/) {
+ if (ref($settings->{$position}) eq 'HASH') {
+ if ($settings->{$position}->{$type} =~ /^(no|req)$/) {
$checked{$1} = $checked{'yes'};
delete($checked{'yes'});
}
}
+ } else {
+ if ($legacy == 0) {
+ $checked{'req'} = $checked{'yes'};
+ delete($checked{'yes'});
+ }
}
foreach my $option ('no','yes','req') {
$datatable .= ''.(' 'x2);
}
@@ -4722,7 +4810,8 @@ sub ssl_titles {
dom => 'LON-CAPA servers/VMs from same domain',
intdom => 'LON-CAPA servers/VMs from same "internet" domain',
other => 'External LON-CAPA servers/VMs',
- connect => 'Connections to other servers',
+ connto => 'Connections to other servers',
+ connfrom => 'Connections from other servers',
replication => 'Replicating content to other institutions',
certreq => 'Client certificate required, but specific domains exempt',
nocertreq => 'No client certificate required, except for specific domains',
@@ -6074,7 +6163,10 @@ sub print_usermodification {
sub print_defaults {
my ($position,$dom,$settings,$rowtotal) = @_;
my $rownum = 0;
- my ($datatable,$css_class);
+ my ($datatable,$css_class,$titles);
+ unless ($position eq 'bottom') {
+ $titles = &defaults_titles($dom);
+ }
if ($position eq 'top') {
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def',
'datelocale_def','portal_def');
@@ -6087,7 +6179,6 @@ sub print_defaults {
$defaults{$item} = $domdefaults{$item};
}
}
- my $titles = &defaults_titles($dom);
foreach my $item (@items) {
if ($rownum%2) {
$css_class = '';
@@ -6135,8 +6226,87 @@ sub print_defaults {
$datatable .= '';
$rownum ++;
}
+ } elsif ($position eq 'middle') {
+ my @items = ('intauth_cost','intauth_check','intauth_switch');
+ my %defaults;
+ if (ref($settings) eq 'HASH') {
+ %defaults = %{$settings};
+ if ($defaults{'intauth_cost'} !~ /^\d+$/) {
+ $defaults{'intauth_cost'} = 10;
+ }
+ if ($defaults{'intauth_check'} !~ /^(0|1|2)$/) {
+ $defaults{'intauth_check'} = 0;
+ }
+ if ($defaults{'intauth_switch'} !~ /^(0|1|2)$/) {
+ $defaults{'intauth_switch'} = 0;
+ }
+ } else {
+ %defaults = (
+ 'intauth_cost' => 10,
+ 'intauth_check' => 0,
+ 'intauth_switch' => 0,
+ );
+ }
+ foreach my $item (@items) {
+ if ($rownum%2) {
+ $css_class = '';
+ } else {
+ $css_class = ' class="LC_odd_row" ';
+ }
+ $datatable .= ''.
+ ''.$titles->{$item}.
+ ' | ';
+ if ($item eq 'intauth_switch') {
+ my @options = (0,1,2);
+ my %optiondesc = &Apache::lonlocal::texthash (
+ 0 => 'No',
+ 1 => 'Yes',
+ 2 => 'Yes, and copy existing passwd file to passwd.bak file',
+ );
+ $datatable .= '';
+ } elsif ($item eq 'intauth_check') {
+ my @options = (0,1,2);
+ my %optiondesc = &Apache::lonlocal::texthash (
+ 0 => 'No',
+ 1 => 'Yes, allow login then update passwd file using default cost (if higher)',
+ 2 => 'Yes, disallow login if stored cost is less than domain default',
+ );
+ $datatable .= '';
+ } else {
+ $datatable .= '';
+ }
+ $datatable .= ' |
';
+ $rownum ++;
+ }
} else {
- my (%defaults);
+ my %defaults;
if (ref($settings) eq 'HASH') {
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH') &&
(ref($settings->{'inststatusguest'}) eq 'ARRAY')) {
@@ -6231,6 +6401,9 @@ sub defaults_titles {
'timezone_def' => 'Default timezone',
'datelocale_def' => 'Default locale for dates',
'portal_def' => 'Portal/Default URL',
+ 'intauth_cost' => 'Encryption cost for bcrypt (positive integer)',
+ 'intauth_check' => 'Check bcrypt cost if authenticated',
+ 'intauth_switch' => 'Existing crypt-based switched to bcrypt on authentication',
);
if ($dom) {
my $uprimary_id = &Apache::lonnet::domain($dom,'primary');
@@ -6766,7 +6939,35 @@ sub serverstatus_pages {
sub defaults_javascript {
my ($settings) = @_;
- return unless (ref($settings) eq 'HASH');
+ my $intauthcheck = &mt('Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.');
+ my $intauthcost = &mt('Warning: bcrypt encryption cost for internal authentication must be an integer.');
+ &js_escape(\$intauthcheck);
+ &js_escape(\$intauthcost);
+ my $intauthjs = <<"ENDSCRIPT";
+
+function warnIntAuth(field) {
+ if (field.name == 'intauth_check') {
+ if (field.value == '2') {
+ alert('$intauthcheck');
+ }
+ }
+ if (field.name == 'intauth_cost') {
+ field.value.replace(/\s/g,'');
+ if (field.value != '') {
+ var regexdigit=/^\\d+\$/;
+ if (!regexdigit.test(field.value)) {
+ alert('$intauthcost');
+ }
+ }
+ }
+ return;
+}
+
+ENDSCRIPT
+
+ if (ref($settings) ne 'HASH') {
+ return &Apache::lonhtmlcommon::scripttag($intauthjs);
+ }
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
my $maxnum = scalar(@{$settings->{'inststatusorder'}});
if ($maxnum eq '') {
@@ -6820,10 +7021,14 @@ $jstext
return;
}
+$intauthjs
+
// ]]>
ENDSCRIPT
+ } else {
+ return &Apache::lonhtmlcommon::scripttag($intauthjs);
}
}
@@ -9274,7 +9479,7 @@ sub process_textbook_image {
sub modify_ltitools {
my ($r,$dom,$action,$lastactref,%domconfig) = @_;
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
- my ($newid,@allpos,%changes,%confhash,$errors,$resulttext);
+ my ($newid,@allpos,%changes,%confhash,%encconfig,$errors,$resulttext);
my $confname = $dom.'-domainconfig';
my $servadm = $r->dir_config('lonAdmEMail');
my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm);
@@ -9299,7 +9504,11 @@ sub modify_ltitools {
foreach my $item ('title','url','key','secret') {
$env{'form.ltitools_add_'.$item} =~ s/(`)/'/g;
if ($env{'form.ltitools_add_'.$item}) {
- $confhash{$newid}{$item} = $env{'form.ltitools_add_'.$item};
+ if (($item eq 'key') || ($item eq 'secret')) {
+ $encconfig{$newid}{$item} = $env{'form.ltitools_add_'.$item};
+ } else {
+ $confhash{$newid}{$item} = $env{'form.ltitools_add_'.$item};
+ }
}
}
if ($env{'form.ltitools_add_version'} eq 'LTI-1p0') {
@@ -9308,11 +9517,17 @@ sub modify_ltitools {
if ($env{'form.ltitools_add_msgtype'} eq 'basic-lti-launch-request') {
$confhash{$newid}{'msgtype'} = $env{'form.ltitools_add_msgtype'};
}
- foreach my $item ('width','height') {
+ foreach my $item ('width','height','linktext','explanation') {
$env{'form.ltitools_add_'.$item} =~ s/^\s+//;
$env{'form.ltitools_add_'.$item} =~ s/\s+$//;
- if ($env{'form.ltitools_add_'.$item} =~ /^\d+$/) {
- $confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item};
+ if (($item eq 'width') || ($item eq 'height')) {
+ if ($env{'form.ltitools_add_'.$item} =~ /^\d+$/) {
+ $confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item};
+ }
+ } else {
+ if ($env{'form.ltitools_add_'.$item} ne '') {
+ $confhash{$newid}{'display'}{$item} = $env{'form.ltitools_add_'.$item};
+ }
}
}
if ($env{'form.ltitools_add_target'} eq 'window') {
@@ -9400,12 +9615,18 @@ sub modify_ltitools {
} else {
my $newpos = $env{'form.ltitools_'.$itemid};
$newpos =~ s/\D+//g;
- foreach my $item ('title','url','key','secret') {
+ foreach my $item ('title','url') {
$confhash{$itemid}{$item} = $env{'form.ltitools_'.$item.'_'.$i};
if ($domconfig{$action}{$itemid}{$item} ne $confhash{$itemid}{$item}) {
$changes{$itemid} = 1;
}
}
+ foreach my $item ('key','secret') {
+ $encconfig{$itemid}{$item} = $env{'form.ltitools_'.$item.'_'.$i};
+ if ($domconfig{$action}{$itemid}{$item} ne $encconfig{$itemid}{$item}) {
+ $changes{$itemid} = 1;
+ }
+ }
if ($env{'form.ltitools_version_'.$i} eq 'LTI-1p0') {
$confhash{$itemid}{'version'} = $env{'form.ltitools_version_'.$i};
}
@@ -9424,6 +9645,28 @@ sub modify_ltitools {
} else {
$changes{$itemid} = 1;
}
+ } elsif (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') {
+ if ($domconfig{$action}{$itemid}{'display'}{$size} ne '') {
+ $changes{$itemid} = 1;
+ }
+ }
+ }
+ foreach my $item ('linktext','explanation') {
+ $env{'form.ltitools_'.$item.'_'.$i} =~ s/^\s+//;
+ $env{'form.ltitools_'.$item.'_'.$i} =~ s/\s+$//;
+ if ($env{'form.ltitools_'.$item.'_'.$i} ne '') {
+ $confhash{$itemid}{'display'}{$item} = $env{'form.ltitools_'.$item.'_'.$i};
+ if (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') {
+ if ($domconfig{$action}{$itemid}{'display'}{$item} ne $confhash{$itemid}{'display'}{$item}) {
+ $changes{$itemid} = 1;
+ }
+ } else {
+ $changes{$itemid} = 1;
+ }
+ } elsif (ref($domconfig{$action}{$itemid}{'display'}) eq 'HASH') {
+ if ($domconfig{$action}{$itemid}{'display'}{$item} ne '') {
+ $changes{$itemid} = 1;
+ }
}
}
if ($env{'form.ltitools_target_'.$i} eq 'window') {
@@ -9447,7 +9690,7 @@ sub modify_ltitools {
}
}
my @courseconfig = &Apache::loncommon::get_env_multiple('form.ltitools_courseconfig_'.$i);
- foreach my $item ('label','title','target') {
+ foreach my $item ('label','title','target','linktext','explanation') {
if (grep(/^\Q$item\E$/,@courseconfig)) {
$confhash{$itemid}{'crsconf'}{$item} = 1;
if (ref($domconfig{$action}{$itemid}{'crsconf'}) eq 'HASH') {
@@ -9586,9 +9829,21 @@ sub modify_ltitools {
my $putresult = &Apache::lonnet::put_dom('configuration',\%ltitoolshash,
$dom);
if ($putresult eq 'ok') {
+ my %ltienchash = (
+ $action => { %encconfig }
+ );
+ &Apache::lonnet::put_dom('encconfig',\%ltienchash,$dom);
if (keys(%changes) > 0) {
my $cachetime = 24*60*60;
- &Apache::lonnet::do_cache_new('ltitools',$dom,\%confhash,$cachetime);
+ my %ltiall = %confhash;
+ foreach my $id (keys(%ltiall)) {
+ if (ref($encconfig{$id}) eq 'HASH') {
+ foreach my $item ('key','secret') {
+ $ltiall{$id}{$item} = $encconfig{$id}{$item};
+ }
+ }
+ }
+ &Apache::lonnet::do_cache_new('ltitools',$dom,\%ltiall,$cachetime);
if (ref($lastactref) eq 'HASH') {
$lastactref->{'ltitools'} = 1;
}
@@ -9612,24 +9867,27 @@ sub modify_ltitools {
$resulttext .= '';
my $position = $pos + 1;
$resulttext .= '- '.&mt('Order: [_1]',$position).'
';
- foreach my $item ('version','msgtype','url','key') {
+ foreach my $item ('version','msgtype','url') {
if ($confhash{$itemid}{$item} ne '') {
$resulttext .= '- '.$lt{$item}.': '.$confhash{$itemid}{$item}.'
';
}
}
- if ($confhash{$itemid}{'secret'} ne '') {
+ if ($encconfig{$itemid}{'key'} ne '') {
+ $resulttext .= '- '.$lt{'key'}.': '.$encconfig{$itemid}{'key'}.'
';
+ }
+ if ($encconfig{$itemid}{'secret'} ne '') {
$resulttext .= '- '.$lt{'secret'}.': ';
- my $num = length($confhash{$itemid}{'secret'});
+ my $num = length($encconfig{$itemid}{'secret'});
$resulttext .= ('*'x$num).'
';
}
$resulttext .= '- '.&mt('Configurable in course:');
- my @possconfig = ('label','title','target');
+ my @possconfig = ('label','title','target','linktext','explanation');
my $numconfig = 0;
if (ref($confhash{$itemid}{'crsconf'}) eq 'HASH') {
foreach my $item (@possconfig) {
if ($confhash{$itemid}{'crsconf'}{$item}) {
$numconfig ++;
- $resulttext .= ' '.$lt{'crs'.$item};
+ $resulttext .= ' "'.$lt{'crs'.$item}.'"';
}
}
}
@@ -9662,7 +9920,12 @@ sub modify_ltitools {
$displaylist =~ s/,$//;
$resulttext .= '
- '.$displaylist.'
';
}
- }
+ foreach my $item ('linktext','explanation') {
+ if ($confhash{$itemid}{'display'}{$item}) {
+ $resulttext .= '- '.$lt{$item}.': '.$confhash{$itemid}{'display'}{$item}.'
';
+ }
+ }
+ }
if (ref($confhash{$itemid}{'fields'}) eq 'HASH') {
my $fieldlist;
foreach my $field (@allfields) {
@@ -10158,7 +10421,7 @@ sub modify_autocreate {
}
sub modify_directorysrch {
- my ($dom,%domconfig) = @_;
+ my ($dom,$lastactref,%domconfig) = @_;
my ($resulttext,%changes);
my %currdirsrch;
if (ref($domconfig{'directorysrch'}) eq 'HASH') {
@@ -10352,6 +10615,10 @@ sub modify_directorysrch {
$resulttext .= '- '.&mt($title{'searchtypes'}.' set to: "[_1]"',$chgtext).'
';
}
$resulttext .= '
';
+ &Apache::lonnet::do_cache_new('directorysrch',$dom,$dirsrch_hash{'directorysrch'},3600);
+ if (ref($lastactref) eq 'HASH') {
+ $lastactref->{'directorysrch'} = 1;
+ }
} else {
$resulttext = &mt('No changes made to directory search settings');
}
@@ -11677,7 +11944,8 @@ sub modify_defaults {
my ($dom,$lastactref,%domconfig) = @_;
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors);
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
- my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def','portal_def');
+ my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def',
+ 'portal_def','intauth_cost','intauth_check','intauth_switch');
my @authtypes = ('internal','krb4','krb5','localauth');
foreach my $item (@items) {
$newvalues{$item} = $env{'form.'.$item};
@@ -11719,6 +11987,24 @@ sub modify_defaults {
push(@errors,$item);
}
}
+ } elsif ($item eq 'intauth_cost') {
+ if ($newvalues{$item} ne '') {
+ if ($newvalues{$item} =~ /\D/) {
+ push(@errors,$item);
+ }
+ }
+ } elsif ($item eq 'intauth_check') {
+ if ($newvalues{$item} ne '') {
+ unless ($newvalues{$item} =~ /^(0|1|2)$/) {
+ push(@errors,$item);
+ }
+ }
+ } elsif ($item eq 'intauth_switch') {
+ if ($newvalues{$item} ne '') {
+ unless ($newvalues{$item} =~ /^(0|1|2)$/) {
+ push(@errors,$item);
+ }
+ }
}
if (grep(/^\Q$item\E$/,@errors)) {
$newvalues{$item} = $domdefaults{$item};
@@ -11873,6 +12159,28 @@ sub modify_defaults {
localauth => 'loc',
);
$value = $authnames{$shortauth{$value}};
+ } elsif ($item eq 'intauth_switch') {
+ my %optiondesc = &Apache::lonlocal::texthash (
+ 0 => 'No',
+ 1 => 'Yes',
+ 2 => 'Yes, and copy existing passwd file to passwd.bak file',
+ );
+ if ($value =~ /^(0|1|2)$/) {
+ $value = $optiondesc{$value};
+ } else {
+ $value = &mt('none -- defaults to No');
+ }
+ } elsif ($item eq 'intauth_check') {
+ my %optiondesc = &Apache::lonlocal::texthash (
+ 0 => 'No',
+ 1 => 'Yes, allow login then update passwd file using default cost (if higher)',
+ 2 => 'Yes, disallow login if stored cost is less than domain default',
+ );
+ if ($value =~ /^(0|1|2)$/) {
+ $value = $optiondesc{$value};
+ } else {
+ $value = &mt('none -- defaults to No');
+ }
}
$resulttext .= ''.&mt('[_1] set to "[_2]"',$title->{$item},$value).'';
$mailmsgtext .= "$title->{$item} set to $value\n";
@@ -12457,14 +12765,16 @@ sub modify_helpsettings {
my %existing=&Apache::lonnet::dump('roles',$dom,$confname,'rolesdef_');
my (@allpos,%newsettings,%changedprivs,$newrole);
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- my @accesstypes = ('all','none','status','inc','exc');
- my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh']);
+ my @accesstypes = ('all','dh','da','none','status','inc','exc');
+ my %domhelpdesk = &Apache::lonnet::get_active_domroles($dom,['dh','da']);
my %lt = &Apache::lonlocal::texthash(
s => 'system',
d => 'domain',
order => 'Display order',
access => 'Role usage',
- all => 'All',
+ all => 'All with domain helpdesk or helpdesk assistant role',
+ dh => 'All with domain helpdesk role',
+ da => 'All with domain helpdesk assistant role',
none => 'None',
status => 'Determined based on institutional status',
inc => 'Include all, but exclude specific personnel',
@@ -13588,8 +13898,10 @@ sub modify_usersessions {
}
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
+ &Apache::lonnet::do_cache_new('usersessions',$dom,$defaultshash{'usersessions'},3600);
if (ref($lastactref) eq 'HASH') {
$lastactref->{'domdefaults'} = 1;
+ $lastactref->{'usersessions'} = 1;
}
if (keys(%changes) > 0) {
my %lt = &usersession_titles();
@@ -13690,7 +14002,7 @@ sub modify_ssl {
my %servers = &Apache::lonnet::internet_dom_servers($dom);
my (%defaultshash,%changes);
my $action = 'ssl';
- my @prefixes = ('connect','replication');
+ my @prefixes = ('connto','connfrom','replication');
foreach my $prefix (@prefixes) {
$defaultshash{$action}{$prefix} = {};
}
@@ -13700,12 +14012,13 @@ sub modify_ssl {
my @reptypes = ('certreq','nocertreq');
my @connecttypes = ('dom','intdom','other');
my %types = (
- connect => \@connecttypes,
- replication => \@reptypes,
+ connto => \@connecttypes,
+ connfrom => \@connecttypes,
+ replication => \@reptypes,
);
foreach my $prefix (sort(keys(%types))) {
foreach my $type (@{$types{$prefix}}) {
- if ($prefix eq 'connect') {
+ if (($prefix eq 'connto') || ($prefix eq 'connfrom')) {
my $value = 'yes';
if ($env{'form.'.$prefix.'_'.$type} =~ /^(no|req)$/) {
$value = $env{'form.'.$prefix.'_'.$type};
@@ -13794,8 +14107,11 @@ sub modify_ssl {
if (ref($defaultshash{$action}{'replication'}) eq 'HASH') {
$domdefaults{'replication'} = $defaultshash{$action}{'replication'};
}
- if (ref($defaultshash{$action}{'connect'}) eq 'HASH') {
- $domdefaults{'connect'} = $domconfig{$action}{'connect'};
+ if (ref($defaultshash{$action}{'connto'}) eq 'HASH') {
+ $domdefaults{'connto'} = $domconfig{$action}{'connto'};
+ }
+ if (ref($defaultshash{$action}{'connfrom'}) eq 'HASH') {
+ $domdefaults{'connfrom'} = $domconfig{$action}{'connfrom'};
}
}
my $cachetime = 24*60*60;
@@ -13814,7 +14130,7 @@ sub modify_ssl {
my $newvalue;
if (ref($defaultshash{$action}) eq 'HASH') {
if (ref($defaultshash{$action}{$prefix})) {
- if ($prefix eq 'connect') {
+ if (($prefix eq 'connto') || ($prefix eq 'connfrom')) {
$newvalue = $titles{$defaultshash{$action}{$prefix}{$type}};
} elsif (ref($defaultshash{$action}{$prefix}{$type}) eq 'ARRAY') {
if (@{$defaultshash{$action}{$prefix}{$type}} > 0) {
@@ -14961,7 +15277,7 @@ sub devalidate_remote_domconfs {
my %servers = &Apache::lonnet::internet_dom_servers($dom);
my %thismachine;
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
- my @posscached = ('domainconfig','domdefaults','ltitools');
+ my @posscached = ('domainconfig','domdefaults','ltitools','usersessions','directorysrch');
if (keys(%servers)) {
foreach my $server (keys(%servers)) {
next if ($thismachine{$server});