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

www lon-capa-cvs@mail.lon-capa.org
Wed, 19 Mar 2003 16:50:14 -0000


www		Wed Mar 19 11:50:14 2003 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/xml	londefdef.pm 
  Log:
  Incorporate "role" into custom access rights
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.341 loncom/lonnet/perl/lonnet.pm:1.342
--- loncom/lonnet/perl/lonnet.pm:1.341	Tue Mar 18 02:26:49 2003
+++ loncom/lonnet/perl/lonnet.pm	Wed Mar 19 11:50:14 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.341 2003/03/18 07:26:49 www Exp $
+# $Id: lonnet.pm,v 1.342 2003/03/19 16:50:14 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1874,10 +1874,14 @@
 
 sub customaccess {
     my ($priv,$uri)=@_;
+    my ($urole,$urealm)=split(/\./,$ENV{'request.role'});
+    my ($udm,$ucid,$usec)=split(/\//,$urealm);
     my $access=0;
     foreach (split(/\s*\,\s*/,&metadata($uri,'rule_rights'))) {
-	my ($effect,$realm,$content)=split(/\:/,$_);
-        &logthis('testing '.$effect.' '.$realm.' '.$content);
+	my ($effect,$realm,$role)=split(/\:/,$_);
+        foreach my $thisrealm (split(/\s*\,\s*/,$realm)) {
+            &logthis('testing '.$effect.' '.$thisrealm.' '.$role);
+        }
     }
     return $access;
 }
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.122 loncom/xml/londefdef.pm:1.123
--- loncom/xml/londefdef.pm:1.122	Tue Mar 18 10:32:15 2003
+++ loncom/xml/londefdef.pm	Wed Mar 19 11:50:14 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.122 2003/03/18 15:32:15 albertel Exp $
+# $Id: londefdef.pm,v 1.123 2003/03/19 16:50:14 www Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -394,10 +394,15 @@
 	('effect',$parstack,$safeeval,undef,1);
     my $realm=&Apache::lonxml::get_param
 	('realm',$parstack,$safeeval,undef,1);
-    my $cont=&Apache::lonxml::get_param
-	('content',$parstack,$safeeval,undef,1);
-    $cont=~s/\s+//g;
-    $cont=~s/\W/\;/g;
+    my $role=&Apache::lonxml::get_param
+	('role',$parstack,$safeeval,undef,1);
+    $realm=~s/\s+//g;
+    $realm=~s/\//\_/g;
+    $realm=~s/^\_//;
+    $realm=~s/\W/\;/g;
+    $role=~s/\s+//g;
+    $role=~s/\//\_/g;
+    $role=~s/\W/\;/g;
     if ($target eq 'web') {
 	my $args='';
 	if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
@@ -408,7 +413,7 @@
 	}
     }
     if ($target eq 'meta') {
-	$currentstring='<rule>'.$eff.':'.$realm.':'.$cont.'</rule>';
+	$currentstring='<rule>'.$eff.':'.$realm.':'.$role.'</rule>';
     }
     return $currentstring;
 }