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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 01 Feb 2007 07:13:04 -0000


albertel		Thu Feb  1 02:13:04 2007 EDT

  Modified files:              
    /loncom/auth	loncacc.pm lonracc.pm 
  Log:
  - got the logic backwards
  
  
Index: loncom/auth/loncacc.pm
diff -u loncom/auth/loncacc.pm:1.43 loncom/auth/loncacc.pm:1.44
--- loncom/auth/loncacc.pm:1.43	Mon Nov 27 11:47:16 2006
+++ loncom/auth/loncacc.pm	Thu Feb  1 02:13:04 2007
@@ -2,7 +2,7 @@
 # Cookie Based Access Handler for Construction Area
 # (lonacc: 5/21/99,5/22,5/29,5/31 Gerd Kortemeyer)
 #
-# $Id: loncacc.pm,v 1.43 2006/11/27 16:47:16 albertel Exp $
+# $Id: loncacc.pm,v 1.44 2007/02/01 07:13:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -32,15 +32,14 @@
 use strict;
 use Apache::Constants qw(:common :http :methods REDIRECT);
 use CGI::Cookie();
-use Fcntl qw(:flock);
 use Apache::lonlocal;
 use Apache::lonnet;
-use Apache::lonacc;
+use Apache::lonacc();
 use LONCAPA qw(:DEFAULT :match);
 
 sub constructaccess {
     my ($url,$ownerdomain)=@_;
-    my ($ownername)=($url=~/\/(?:\~|priv\/|home\/)($match_username)\//);
+    my ($ownername)=($url=~m{/(?:\~|priv/|home/)($match_username)/});
     unless (($ownername) && ($ownerdomain)) { return ''; }
     # We do not allow editing of previous versions of files.
     if ($url=~/\.(\d+)\.(\w+)$/) { return ''; }
@@ -48,22 +47,25 @@
     if ($ownername eq $env{'user.name'}) {
 	foreach my $domain (@possibledomains) {
 	    if ($domain eq $env{'user.domain'}) {
+    &Apache::lonnet::logthis("good1!");
 		return ($ownername,$domain);
 	    }
 	}
     }
-    
     foreach my $domain (@possibledomains) {
 	if (exists($env{'user.priv.ca./'.$domain.'/'.$ownername.'./'}) ||
 	    exists($env{'user.priv.aa./'.$domain.'/'.$ownername.'./'}) ) {
+    &Apache::lonnet::logthis("good2!");
 	    return ($ownername,$domain);
 	}
     }
+    &Apache::lonnet::logthis("boo! hiss!");
     return '';
 }
 
 sub handler {
     my $r = shift;
+
     my $requrl=$r->uri;
     $env{'request.editurl'}=$requrl;
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
Index: loncom/auth/lonracc.pm
diff -u loncom/auth/lonracc.pm:1.19 loncom/auth/lonracc.pm:1.20
--- loncom/auth/lonracc.pm:1.19	Thu Feb  1 01:31:33 2007
+++ loncom/auth/lonracc.pm	Thu Feb  1 02:13:04 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Access Handler for File Transfers
 #
-# $Id: lonracc.pm,v 1.19 2007/02/01 06:31:33 albertel Exp $
+# $Id: lonracc.pm,v 1.20 2007/02/01 07:13:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,7 +37,7 @@
 sub subscribed {
     my ($filename,$id) = @_;
 
-    return 0 if (-e "$filename.subscription");
+    return 0 if (!-e "$filename.subscription");
 
     my $hostname=$Apache::lonnet::hostname{$id};
     my (undef,undef,undef,undef,$ip) = gethostbyname($hostname);