[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 05 Jul 2008 17:50:59 -0000


raeburn		Sat Jul  5 13:50:59 2008 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - role is in $env{'form.switchrole'} when CC is switching into a role in course context
  - correction to regexp to extract section from adhoc role.  
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.197 loncom/auth/lonroles.pm:1.198
--- loncom/auth/lonroles.pm:1.197	Fri Jul  4 15:26:35 2008
+++ loncom/auth/lonroles.pm	Sat Jul  5 13:50:57 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.197 2008/07/04 19:26:35 raeburn Exp $
+# $Id: lonroles.pm,v 1.198 2008/07/05 17:50:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1073,17 +1073,17 @@
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
     if (&check_forcc($cdom,$cnum,$then)) {
         my $setprivs;
-        if (!defined($env{'user.role.'.$env{'form.selectrole'}})) {
+        if (!defined($env{'user.role.'.$env{'form.switchrole'}})) {
             $setprivs = 1;
         } else {
-            my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.selectrole'}});
+            my ($start,$end) = split(/\./,$env{'user.role.'.$env{'form.switchrole'}});
             if (($start && ($start>$then || $start == -1)) ||
                 ($end && $end<$then)) {
                 $setprivs = 1;
             }
         } 
         if ($setprivs) {
-            if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E(/?\w*)$-) {
+            if ($env{'form.switchrole'} =~ m-^(in|ta|ep|ad|st|cr)([\w/]*)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) {
                 my $role = $1;
                 my $custom_role = $2;
                 my $usec = $3;