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

www lon-capa-cvs@mail.lon-capa.org
Sat, 15 Jun 2002 19:45:26 -0000


www		Sat Jun 15 15:45:26 2002 EDT

  Modified files:              
    /loncom/auth	lonacc.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Bug 488
  Undo version 1.32 of lonacc to avoid unneccessary calls to metadata.
  Postpone to lonnet::allowed call.
  Deal with 'priv' while we are at it. 
  
  
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.32 loncom/auth/lonacc.pm:1.33
--- loncom/auth/lonacc.pm:1.32	Sat Jun 15 15:20:14 2002
+++ loncom/auth/lonacc.pm	Sat Jun 15 15:45:26 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.32 2002/06/15 19:20:14 www Exp $
+# $Id: lonacc.pm,v 1.33 2002/06/15 19:45:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -82,9 +82,6 @@
 	       $ENV{'request.state'} = 'unknown';
             }
             $ENV{'request.filename'} = $r->filename;
-
-            $ENV{'request.copyright'} = 
-		&Apache::lonnet::metadata($requrl,'copyright');
 
 # -------------------------------------------------------- Load POST parameters
 
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.237 loncom/lonnet/perl/lonnet.pm:1.238
--- loncom/lonnet/perl/lonnet.pm:1.237	Fri Jun 14 16:47:45 2002
+++ loncom/lonnet/perl/lonnet.pm	Sat Jun 15 15:45:26 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.237 2002/06/14 20:47:45 www Exp $
+# $Id: lonnet.pm,v 1.238 2002/06/15 19:45:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1501,7 +1501,21 @@
 # Free bre to public access
 
     if ($priv eq 'bre') {
-	if (&metadata($uri,'copyright') eq 'public') { return 'F'; }
+        my $copyright=&metadata($uri,'copyright');
+	if ($copyright eq 'public') { return 'F'; }
+        if ($copyright eq 'priv') {
+            $uri=~/([^\/]+)\/([^\/]+)\//;
+	    unless (($ENV{'user.name'} eq $2) && ($ENV{'user.domain'} eq $1)) {
+		return '';
+            }
+        }
+        if ($copyright eq 'domain') {
+            $uri=~/([^\/]+)\/([^\/]+)\//;
+	    unless (($ENV{'user.domain'} eq $1) ||
+                 ($ENV{'course.'.$ENV{'request.course.id'}.'.domain'} eq $1)) {
+		return '';
+            }
+        }
     }
 
     my $thisallowed='';