--- loncom/interface/domainprefs.pm 2025/01/12 18:26:16 1.447.2.2 +++ loncom/interface/domainprefs.pm 2025/03/15 01:07:42 1.447.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.447.2.2 2025/01/12 18:26:16 raeburn Exp $ +# $Id: domainprefs.pm,v 1.447.2.6 2025/03/15 01:07:42 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -563,11 +563,7 @@ sub handler { header => [{col1 => 'Role assigned in different domain', col2 => 'Approval options'}, {col1 => 'Role assigned in different domain to user of type', - col2 => 'User information available in that domain'}, - {col1 => "Role assigned in user's domain", - col2 => 'Information viewable by privileged user'}, - {col1 => "Role assigned in user's domain", - col2 => 'Information viewable by unprivileged user'}], + col2 => 'User information available in that domain'}], print => \&print_privacy, modify => \&modify_privacy, }, @@ -1008,8 +1004,8 @@ sub print_config_box { ($action eq 'selfcreation') || ($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'coursecategories') || ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults') || - ($action eq 'privacy') || ($action eq 'passwords') || ($action eq 'lti') || - ($action eq 'ltitools') || ($action eq 'usermodification')) { + ($action eq 'passwords') || ($action eq 'lti') || ($action eq 'ltitools') || + ($action eq 'usermodification')) { if ($action eq 'coursecategories') { $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); $colspan = ' colspan="2"'; @@ -1079,8 +1075,8 @@ sub print_config_box { '."\n"; if ($action eq 'coursecategories') { $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); - } elsif (($action eq 'contacts') || ($action eq 'privacy') || - ($action eq 'passwords') || ($action eq 'lti')) { + } elsif (($action eq 'contacts') || ($action eq 'passwords') || + ($action eq 'lti')) { if ($action eq 'passwords') { $output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal); } else { @@ -1115,7 +1111,7 @@ sub print_config_box { $rowtotal ++; } elsif (($action eq 'coursedefaults') || ($action eq 'authordefaults') || ($action eq 'directorysrch') || ($action eq 'helpsettings') || - ($action eq 'wafproxy')) { + ($action eq 'wafproxy') || ($action eq 'privacy')) { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'scantron') { $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal); @@ -5375,42 +5371,6 @@ sub print_ltitools { return $datatable; } -sub ltitools_names { - my %lt = &Apache::lonlocal::texthash( - 'title' => 'Title', - 'version' => 'Version', - 'msgtype' => 'Message Type', - 'sigmethod' => 'Signature Method', - 'url' => 'URL', - 'key' => 'Key', - 'lifetime' => 'Nonce lifetime (s)', - 'secret' => 'Secret', - 'icon' => 'Icon', - 'user' => 'User', - 'fullname' => 'Full Name', - 'firstname' => 'First Name', - 'lastname' => 'Last Name', - 'email' => 'E-mail', - 'roles' => 'Role', - 'window' => 'Window', - 'tab' => 'Tab', - 'iframe' => 'iFrame', - 'height' => 'Height', - 'width' => 'Width', - 'linktext' => 'Default Link Text', - 'explanation' => 'Default Explanation', - 'passback' => 'Tool can return grades:', - 'roster' => 'Tool can retrieve roster:', - 'crstarget' => 'Display target', - 'crslabel' => 'Course label', - 'crstitle' => 'Course title', - 'crslinktext' => 'Link Text', - 'crsexplanation' => 'Explanation', - 'crsappend' => 'Provider URL', - ); - return %lt; -} - sub secrets_form { my ($dom,$context,$encrypt,$privkeys,$rowtotal) = @_; my @ids=&Apache::lonnet::current_machine_ids(); @@ -7789,7 +7749,7 @@ sub print_privacy { ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); } - if (($position eq 'top') || ($position eq 'middle')) { + if (($position eq 'top') || ($position eq 'bottom')) { my (%by_ip,%by_location,@intdoms,@instdoms); &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms); if ($position eq 'top') { @@ -7876,7 +7836,7 @@ sub print_privacy { $datatable .= &mt('Nothing to set here, as there are no other domains'); } $datatable .=''; - } elsif ($position eq 'middle') { + } elsif ($position eq 'bottom') { if ((@instdoms > 1) || (keys(%by_location) > 0)) { if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { foreach my $item (@{$types}) { @@ -7913,19 +7873,6 @@ sub print_privacy { } } } - } else { - my $prefix; - if ($position eq 'lower') { - $prefix = 'priv'; - } else { - $prefix = 'unpriv'; - } - foreach my $item (@items) { - $datatable .= &modifiable_userdata_row('privacy',$prefix.'_'.$item,$settings, - $numinrow,$itemcount,'','','','','', - '',$names{$item}); - $itemcount ++; - } } if (ref($rowtotal)) { $$rowtotal += $itemcount; @@ -7954,7 +7901,6 @@ sub print_passwords { min => 'Minimum password length', max => 'Maximum password length', chars => 'Required characters', - expire => 'Password expiration (days)', numsaved => 'Number of previous passwords to save and disallow reuse', ); if ($position eq 'top') { @@ -8281,7 +8227,7 @@ sub print_passwords { sub password_rules { my ($prefix,$itemcountref,$settings) = @_; - my ($min,$max,%chars,$expire,$numsaved,$numinrow); + my ($min,$max,%chars,$numsaved,$numinrow); my %titles; if ($prefix eq 'passwords') { %titles = &Apache::lonlocal::texthash ( @@ -8313,9 +8259,6 @@ sub password_rules { map { $chars{$_} = 1; } (@{$settings->{chars}}); } if ($prefix eq 'passwords') { - if ($settings->{expire}) { - $expire = $settings->{expire}; - } if ($settings->{numsaved}) { $numsaved = $settings->{numsaved}; } @@ -8377,17 +8320,8 @@ sub password_rules { $datatable .=''; $itemcount ++; if ($prefix eq 'passwords') { - $titles{'expire'} = &mt('Password expiration (days)'); $titles{'numsaved'} = &mt('Number of previous passwords to save and disallow reuse'); $css_class = $itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''.$titles{'expire'}.''. - ''. - ''. - ' '.&mt('(Leave blank for no expiration)').''. - ''; - $itemcount ++; - $css_class = $itemcount%2?' class="LC_odd_row"':''; $datatable .= ''.$titles{'numsaved'}.''. ''. ' {}, }, 'othdom' => {}, - 'priv' => {}, - 'unpriv' => {}, ); foreach my $item (@items) { if (@instdoms > 1) { @@ -17942,39 +17860,6 @@ sub modify_privacy { $changes{'approval'} = 1; } } - foreach my $status ('priv','unpriv') { - my @possibles = sort(&Apache::loncommon::get_env_multiple('form.privacy_'.$status.'_'.$item)); - my @newvalues; - foreach my $field (@possibles) { - if (grep(/^\Q$field\E$/,@fields)) { - $privacyhash{$status}{$item}{$field} = 1; - push(@newvalues,$field); - } - } - @newvalues = sort(@newvalues); - if (ref($current{$status}) eq 'HASH') { - if (ref($current{$status}{$item}) eq 'HASH') { - my @currvalues = sort(keys(%{$current{$status}{$item}})); - my @diffs = &Apache::loncommon::compare_arrays(\@currvalues,\@newvalues); - if (@diffs > 0) { - $changes{$status} = 1; - } - } - } else { - my @stdfields; - foreach my $field (@fields) { - if ($field eq 'id') { - next if ($status eq 'unpriv'); - next if (($status eq 'priv') && ($item eq 'community')); - } - push(@stdfields,$field); - } - my @diffs = &Apache::loncommon::compare_arrays(\@stdfields,\@newvalues); - if (@diffs > 0) { - $changes{$status} = 1; - } - } - } } if ((@instdoms > 1) || (keys(%by_location) > 0)) { my @statuses; @@ -17998,6 +17883,8 @@ sub modify_privacy { if (@diffs > 0) { $changes{'othdom'} = 1; } + } elsif (@newvalues > 0) { + $changes{'othdom'} = 1; } } else { my @stdfields = ('lastname','firstname','middlename','generation','permanentemail'); @@ -18027,7 +17914,7 @@ sub modify_privacy { if ($putresult eq 'ok') { if (keys(%changes) > 0) { $resulttext = &mt('Changes made: ').'
    '; - foreach my $key ('approval','notify','othdom','priv','unpriv') { + foreach my $key ('approval','notify','othdom') { if ($changes{$key}) { $resulttext .= '
  • '.$titles{$key}.':
      '; if ($key eq 'approval') { @@ -18078,18 +17965,6 @@ sub modify_privacy { $resulttext .= ''; } } - } else { - foreach my $item (@items) { - if (ref($privacyhash{$key}{$item}) eq 'HASH') { - $resulttext .= '
    • '.$names{$item}.': '; - if (keys(%{$privacyhash{$key}{$item}})) { - $resulttext .= join(', ', map { $fieldnames{$_}; } (sort(keys(%{$privacyhash{$key}{$item}})))); - } else { - $resulttext .= &mt('none'); - } - $resulttext .= '
    • '; - } - } } $resulttext .= '
  • '; } @@ -18152,7 +18027,6 @@ sub modify_passwords { min => 'Minimum password length', max => 'Maximum password length', chars => 'Required characters', - expire => 'Password expiration (days)', numsaved => 'Number of previous passwords to save', reset => 'Resetting Forgotten Password', intauth => 'Encryption of Stored Passwords (Internal Auth)', @@ -18536,7 +18410,7 @@ sub modify_passwords { $resulttext .= '
  • '.&mt('[_1] set to "[_2]"',$titles{$key.'_'.$item},$value).'
  • '; } } elsif ($key eq 'rules') { - foreach my $rule ('min','max','expire','numsaved') { + foreach my $rule ('min','max','numsaved') { if ($confighash{'passwords'}{$rule} eq '') { if ($rule eq 'min') { $resulttext .= '
  • '.&mt('[_1] not set.',$titles{$rule}); @@ -18631,7 +18505,7 @@ sub password_rule_changes { (ref($changes) eq 'HASH')); my (@rules,%staticdefaults); if ($prefix eq 'passwords') { - @rules = ('min','max','expire','numsaved'); + @rules = ('min','max','numsaved'); } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) { @rules = ('min','max'); } @@ -18639,12 +18513,7 @@ sub password_rule_changes { foreach my $rule (@rules) { $env{'form.'.$prefix.'_'.$rule} =~ s/^\s+|\s+$//g; my $ruleok; - if ($rule eq 'expire') { - if (($env{'form.'.$prefix.'_'.$rule} =~ /^\d+(|\.\d*)$/) && - ($env{'form.'.$prefix.'_'.$rule} ne '0')) { - $ruleok = 1; - } - } elsif ($rule eq 'min') { + if ($rule eq 'min') { if ($env{'form.'.$prefix.'_'.$rule} =~ /^\d+$/) { if ($env{'form.'.$prefix.'_'.$rule} >= $staticdefaults{$rule}) { $ruleok = 1;