[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonuserutils.pm

raeburn raeburn@source.lon-capa.org
Wed, 20 Jan 2010 20:31:19 -0000


raeburn		Wed Jan 20 20:31:19 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonuserutils.pm 
  Log:
  - Backport 1.104.
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.97.2.6 loncom/interface/lonuserutils.pm:1.97.2.7
--- loncom/interface/lonuserutils.pm:1.97.2.6	Wed Jan 20 20:28:40 2010
+++ loncom/interface/lonuserutils.pm	Wed Jan 20 20:31:19 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.97.2.6 2010/01/20 20:28:40 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.97.2.7 2010/01/20 20:31:19 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1177,7 +1177,7 @@
     my %customroles;
     my ($options,$coursepick,$cb_jscript);
     if ($context ne 'author') {
-        %customroles = &my_custom_roles();
+        %customroles = &my_custom_roles($crstype);
     }
 
     my %lt=&Apache::lonlocal::texthash(
@@ -1351,10 +1351,14 @@
 # ======================================================= Existing Custom Roles
 
 sub my_custom_roles {
+    my ($crstype) = @_;
     my %returnhash=();
     my %rolehash=&Apache::lonnet::dump('roles');
-    foreach my $key (keys %rolehash) {
+    foreach my $key (keys(%rolehash)) {
         if ($key=~/^rolesdef\_(\w+)$/) {
+            if ($crstype eq 'Community') {
+                next if ($rolehash{$key} =~ /bre\&S/); 
+            }
             $returnhash{$1}=$1;
         }
     }
@@ -3903,7 +3907,7 @@
             }
         }
         my (%curr_rules,%got_rules,%alerts);
-        my %customroles = &my_custom_roles();
+        my %customroles = &my_custom_roles($crstype);
         my @permitted_roles = 
             &roles_on_upload($context,$setting,$crstype,%customroles); 
         # Get new users list