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

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 08 Aug 2002 19:29:30 -0000


matthew		Thu Aug  8 15:29:30 2002 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  Added $ENV{'request.role.domain'} to keep track of the domain a requested
  role is int.  Also got rid of $dum1 and $dum2 in favor of undef.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.39 loncom/auth/lonroles.pm:1.40
--- loncom/auth/lonroles.pm:1.39	Tue May 21 11:01:12 2002
+++ loncom/auth/lonroles.pm	Thu Aug  8 15:29:30 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.39 2002/05/21 15:01:12 stredwic Exp $
+# $Id: lonroles.pm,v 1.40 2002/08/08 19:29:30 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -69,14 +69,15 @@
 	    my %temp=('logout_'.$ENV{'request.course.id'} => time);
 	    &Apache::lonnet::put('email_status',\%temp);
         }
-       &Apache::lonnet::appenv("request.course.id"  => '',
-                               "request.course.fn"  => '',
-                               "request.course.uri" => '',
-                               "request.course.sec" => '',
-                               "request.role" => 'cm'); 
+       &Apache::lonnet::appenv("request.course.id"   => '',
+                               "request.course.fn"   => '',
+                               "request.course.uri"  => '',
+                               "request.course.sec"  => '',
+                               "request.role"        => 'cm',
+                               "request.role.domain" => $ENV{'user.domain'}); 
         foreach $envkey (keys %ENV) {
-         if ($envkey=~/^user\.role\./) {
-	    my ($dum1,$dum2,$role,@pwhere)=split(/\./,$envkey);
+            next if ($envkey!~/^user\.role\./);
+	    my (undef,undef,$role,@pwhere)=split(/\./,$envkey);
             my $where=join('.',@pwhere);
             my $trolecode=$role.'.'.$where;
             if ($ENV{'form.'.$trolecode}) {
@@ -94,8 +95,9 @@
                if ($tstatus eq 'is') {
                    $where=~s/^\///;
                    my ($cdom,$cnum,$csec)=split(/\//,$where);
-                   &Apache::lonnet::appenv('request.role' => $trolecode,
-                                           'request.course.sec' => $csec);
+                   &Apache::lonnet::appenv('request.role'        => $trolecode,
+                                           'request.role.domain' => $cdom,
+                                           'request.course.sec'  => $csec);
                    my $msg='Entering course ...';
                    if (($cnum) && ($role ne 'ca')) {
 		      my ($furl,$ferr)=
@@ -134,9 +136,8 @@
                    }
                }
             } 
-	  }
         }
-   }
+    }
         
 
 # =============================================================== No Roles Init
@@ -171,7 +172,7 @@
     my $advanced=0;
     foreach $envkey (keys %ENV) {
         if ($envkey=~/^user\.role\./) {
-	    my ($dum1,$dum2,$role,@pwhere)=split(/\./,$envkey);
+	    my (undef,undef,$role,@pwhere)=split(/\./,$envkey);
             if ($role ne 'st') { $advanced=1; }
         }
     }
@@ -238,7 +239,7 @@
     foreach $envkey (sort keys %ENV) {
         my $button = 1;
         if ($envkey=~/^user\.role\./) {
-	    my ($dum1,$dum2,$role,@pwhere)=split(/\./,$envkey);
+	    my (undef,undef,$role,@pwhere)=split(/\./,$envkey);
             my $where=join('.',@pwhere);
             my $trolecode=$role.'.'.$where;
             my ($tstart,$tend)=split(/\./,$ENV{$envkey});