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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Tue, 06 Nov 2007 13:05:01 -0000


raeburn		Tue Nov  6 08:05:01 2007 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Can use &get_my_roles() to search for custom roles, by including 'cr' in the array ref of roles passed to it.
  - &get_domain_roles() checks that the $roles argument passed to it was an array ref before doing join() to generate $rolelist.
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.921 loncom/lonnet/perl/lonnet.pm:1.922
--- loncom/lonnet/perl/lonnet.pm:1.921	Sat Oct  6 00:32:40 2007
+++ loncom/lonnet/perl/lonnet.pm	Tue Nov  6 08:05:00 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.921 2007/10/06 04:32:40 raeburn Exp $
+# $Id: lonnet.pm,v 1.922 2007/11/06 13:05:00 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2463,7 +2463,13 @@
         }
         if (ref($roles) eq 'ARRAY') {
             if (!grep(/^\Q$role\E$/,@{$roles})) {
-                next;
+                if ($role =~ /^cr\//) {
+                    if (!grep(/^cr$/,@{$roles})) {
+                        next;
+                    }
+                } else {
+                    next;
+                }
             }
         }
 	$returnhash{$username.':'.$domain.':'.$role}=$tstart.':'.$tend;
@@ -2621,7 +2627,10 @@
     if (undef($enddate) || $enddate eq '') {
         $enddate = '.';
     }
-    my $rolelist = join(':',@{$roles});
+    my $rolelist;
+    if (ref($roles) eq 'ARRAY') {
+        $rolelist = join(':',@{$roles});
+    }
     my %personnel = ();
 
     my %servers = &get_servers($dom,'library');