[LON-CAPA-cvs] cvs: loncom /cgi lonauthcgi.pm

raeburn raeburn at source.lon-capa.org
Sun Oct 27 13:16:37 EDT 2013


raeburn		Sun Oct 27 17:16:37 2013 EDT

  Modified files:              
    /loncom/cgi	lonauthcgi.pm 
  Log:
  - Eliminate duplication of domains in list returned by &can_view(). 
  
  
Index: loncom/cgi/lonauthcgi.pm
diff -u loncom/cgi/lonauthcgi.pm:1.10 loncom/cgi/lonauthcgi.pm:1.11
--- loncom/cgi/lonauthcgi.pm:1.10	Sat Feb  2 00:22:34 2013
+++ loncom/cgi/lonauthcgi.pm	Sun Oct 27 17:16:36 2013
@@ -1,7 +1,7 @@
 #
 # LON-CAPA authorization for cgi-bin scripts
 #
-# $Id: lonauthcgi.pm,v 1.10 2013/02/02 00:22:34 raeburn Exp $
+# $Id: lonauthcgi.pm,v 1.11 2013/10/27 17:16:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -280,12 +280,13 @@
             }
         }
         unless ($allowed) {
+            my %alloweddoms;   
             foreach my $dom (@poss_domains) {
                 my %domconfig = &Apache::lonnet::get_dom('configuration',['serverstatuses'],
                                                          $dom);
                 if ($Apache::lonnet::env{'request.role'} eq "dc./$dom/") {
                     if ($page eq 'domconf') {
-                        $allowed .= $dom.'&';
+                        $alloweddoms{$dom} = 1;
                     } else {
                         $allowed = 1; 
                     }
@@ -295,7 +296,7 @@
                             my @okusers = split(/,/,$domconfig{'serverstatuses'}{$page}{'namedusers'});
                             if (grep(/^\Q$Apache::lonnet::env{'user.name'}:$Apache::lonnet::env{'user.domain'}\E$/, at okusers)) {
                                 if ($page eq 'domconf') {
-                                    $allowed .= $dom.'&';
+                                    $alloweddoms{$dom} = 1;
                                 } else {
                                     $allowed = 1;
                                 }
@@ -307,7 +308,9 @@
                     }
                 }
             }
-            $allowed =~ s/\&$//;
+            if (($page eq 'domconf') && (!$allowed))  {
+                $allowed = join('&',sort(keys(%alloweddoms)));
+            }
         }
     }
     return $allowed;




More information about the LON-CAPA-cvs mailing list