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

raeburn raeburn@source.lon-capa.org
Tue, 19 May 2009 20:00:24 -0000


raeburn		Tue May 19 20:00:24 2009 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Sanity checking.
   - Confirm $cancreate{'selfcreate'} and $cancreate{'statustocreate'} are array refs.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.95 loncom/interface/domainprefs.pm:1.96
--- loncom/interface/domainprefs.pm:1.95	Thu May  7 19:36:49 2009
+++ loncom/interface/domainprefs.pm	Tue May 19 20:00:24 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.95 2009/05/07 19:36:49 www Exp $
+# $Id: domainprefs.pm,v 1.96 2009/05/19 20:00:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4200,22 +4200,25 @@
                             $chgtext .= '</ul>';
                         }
                     } elsif ($type eq 'statustocreate') {
-                        if (@{$cancreate{'selfcreate'}} > 0) {
-                            if (@{$cancreate{$type}} == 0) {
-                                if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) {
-                                    $chgtext .= &mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.");
-                                }
-                            } elsif (ref($usertypes) eq 'HASH') {
-                                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):').'<ul>';
-                                    foreach my $case (@{$cancreate{$type}}) {
-                                        if ($case eq 'default') {
-                                            $chgtext .= '<li>'.$othertitle.'</li>';
-                                        } else {
-                                            $chgtext .= '<li>'.$usertypes->{$case}.'</li>';
+                        if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') &&
+                            (ref($cancreate{'statustocreate'}) eq 'ARRAY')) {
+                            if (@{$cancreate{'selfcreate'}} > 0) {
+                                if (@{$cancreate{'statustocreate'}} == 0) {
+                                    if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) {
+                                        $chgtext .= &mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts.");
+                                    }
+                                } elsif (ref($usertypes) eq 'HASH') {
+                                    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):').'<ul>';
+                                        foreach my $case (@{$cancreate{$type}}) {
+                                            if ($case eq 'default') {
+                                                $chgtext .= '<li>'.$othertitle.'</li>';
+                                            } else {
+                                                $chgtext .= '<li>'.$usertypes->{$case}.'</li>';
+                                            }
                                         }
+                                        $chgtext .= '</ul>';
                                     }
-                                    $chgtext .= '</ul>';
                                 }
                             }
                         }