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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Fri, 21 Dec 2007 04:47:24 -0000


raeburn		Thu Dec 20 23:47:24 2007 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  If username rules have been defined for a domian in localenroll.pm, then
  the types of user which may be created in author and/or course context
  can be set by the DC to be any, institutional only, non-institutional or none.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.36 loncom/interface/domainprefs.pm:1.37
--- loncom/interface/domainprefs.pm:1.36	Sun Dec 16 12:48:18 2007
+++ loncom/interface/domainprefs.pm	Thu Dec 20 23:47:24 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.36 2007/12/16 17:48:18 raeburn Exp $
+# $Id: domainprefs.pm,v 1.37 2007/12/21 04:47:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1333,6 +1333,8 @@
         }
     } elsif ($position eq 'middle') {
         my @creators = ('author','course');
+        my ($rules,$ruleorder) =
+            &Apache::lonnet::inst_userrules($dom,'username');
         my %lt = &usercreation_types();
         my %checked;
         if (ref($settings) eq 'HASH') {
@@ -1363,7 +1365,14 @@
             $datatable .= '<tr'.$css_class.'>'.
                          '<td><span class="LC_nobreak">'.$lt{$item}.
                          '</span></td><td align="right">';
-            foreach my $option ('any','official','unofficial','none') {
+            my @options = ('any');
+            if (ref($rules) eq 'HASH') {
+                if (keys(%{$rules}) > 0) {
+                    push(@options,('official','unofficial'));
+                }
+            }
+            push(@options,'none');
+            foreach my $option (@options) {
                 my $check = ' ';
                 if ($checked{$item} eq $option) {
                     $check = ' checked="checked" ';
@@ -2109,7 +2118,7 @@
 sub check_authorstatus {
     my ($dom,$confname,%currroles) = @_;
     my $author_ok;
-    if (!$currroles{':'.$dom.':au'}) {
+    if (!$currroles{$confname.':'.$dom.':au'}) {
         my $start = time;
         my $end = 0;
         $author_ok =