[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm

raeburn raeburn at source.lon-capa.org
Fri Apr 26 16:15:30 EDT 2019


raeburn		Fri Apr 26 20:15:30 2019 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Update cached passwdconf if DC changes domain configuration for passwords. 
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.354 loncom/interface/domainprefs.pm:1.355
--- loncom/interface/domainprefs.pm:1.354	Mon Apr 22 01:55:17 2019
+++ loncom/interface/domainprefs.pm	Fri Apr 26 20:15:30 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.354 2019/04/22 01:55:17 raeburn Exp $
+# $Id: domainprefs.pm,v 1.355 2019/04/26 20:15:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -13960,7 +13960,8 @@
 
 sub modify_passwords {
     my ($r,$dom,$confname,$lastactref,%domconfig) = @_;
-    my ($resulttext,%current,%changes,%newvalues, at oktypes,$errors,$updatedefaults);
+    my ($resulttext,%current,%changes,%newvalues, at oktypes,$errors,
+        $updatedefaults,$updateconf);
     my $customfn = 'resetpw.html';
     if (ref($domconfig{'passwords'}) eq 'HASH') {
         %current = %{$domconfig{'passwords'}};
@@ -14248,6 +14249,9 @@
             $resulttext = &mt('Changes made: ').'<ul>';
             foreach my $key ('reset','intauth','rules','crsownerchg') {
                 if ($changes{$key}) {
+                    unless ($key eq 'intauth') {
+                        $updateconf = 1;
+                    }
                     $resulttext .= '<li>'.$titles{$key}.':<ul>';
                     if ($key eq 'reset') {
                         if ($confighash{'passwords'}{'captcha'} eq 'original') {
@@ -14394,13 +14398,19 @@
         } else {
             $resulttext = &mt('No changes made to password settings');
         }
+        my $cachetime = 24*60*60;
         if ($updatedefaults) {
-            my $cachetime = 24*60*60;
             &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
             if (ref($lastactref) eq 'HASH') {
                 $lastactref->{'domdefaults'} = 1;
             }
         }
+        if ($updateconf) {
+            &Apache::lonnet::do_cache_new('passwdconf',$dom,$confighash{'passwords'},$cachetime);
+            if (ref($lastactref) eq 'HASH') {
+                $lastactref->{'passwdconf'} = 1;
+            }
+        }
     } else {
         $resulttext = '<span class="LC_error">'.
             &mt('An error occurred: [_1]',$putresult).'</span>';
@@ -19136,7 +19146,8 @@
     my %servers = &Apache::lonnet::internet_dom_servers($dom);
     my %thismachine;
     map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
-    my @posscached = ('domainconfig','domdefaults','ltitools','usersessions','directorysrch');
+    my @posscached = ('domainconfig','domdefaults','ltitools','usersessions',
+                      'directorysrch','passwdconf');
     if (keys(%servers)) {
         foreach my $server (keys(%servers)) {
             next if ($thismachine{$server});




More information about the LON-CAPA-cvs mailing list