[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 21 Nov 2005 15:41:30 -0000


raeburn		Mon Nov 21 10:41:30 2005 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Group privs now set for roles which include section numbers. 
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.680 loncom/lonnet/perl/lonnet.pm:1.681
--- loncom/lonnet/perl/lonnet.pm:1.680	Thu Nov 17 11:58:23 2005
+++ loncom/lonnet/perl/lonnet.pm	Mon Nov 21 10:41:29 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.680 2005/11/17 16:58:23 www Exp $
+# $Id: lonnet.pm,v 1.681 2005/11/21 15:41:29 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2693,21 +2693,19 @@
     my $author=0;
     my $adv=0;
     my %grouproles = ();
-    my %groups_checked = ();
     if (keys(%{$allgroups}) > 0) {
         foreach my $role (keys %{$allroles}) {
-            my ($trole,$area);
-            if ($role =~ m|^(\w+)\.(/\w+/\w+)|) {
+            my ($trole,$area,$sec,$extendedarea);
+            if ($role =~ m|^(\w+)\.(/\w+/\w+)(/?\w*)|) {
                 $trole = $1;
                 $area = $2;
-                unless ($groups_checked{$area}) {
-                    $groups_checked{$area} = 1;
-                    if (exists($$allgroups{$area})) {
-                        foreach my $group (keys(%{$$allgroups{$area}})) {
-                            my $spec = $trole.'.'.$area;
-                            $grouproles{$spec.'.'.$area.'/'.$group} = 
-                                                    $$allgroups{$area}{$group};
-                        }
+                $sec = $3;
+                $extendedarea = $area.$sec;
+                if (exists($$allgroups{$area})) {
+                    foreach my $group (keys(%{$$allgroups{$area}})) {
+                        my $spec = $trole.'.'.$extendedarea;
+                        $grouproles{$spec.'.'.$area.'/'.$group} = 
+                                                $$allgroups{$area}{$group};
                     }
                 }
             }