[LON-CAPA-cvs] cvs: loncom /auth loncacc.pm /interface lonmeta.pm /publisher loncfile.pm loncleanup.pm

www www at source.lon-capa.org
Mon Oct 24 18:39:21 EDT 2011


www		Mon Oct 24 22:39:21 2011 EDT

  Modified files:              
    /loncom/auth	loncacc.pm 
    /loncom/interface	lonmeta.pm 
    /loncom/publisher	loncfile.pm loncleanup.pm 
  Log:
  Bug #1320
  
  
Index: loncom/auth/loncacc.pm
diff -u loncom/auth/loncacc.pm:1.54 loncom/auth/loncacc.pm:1.55
--- loncom/auth/loncacc.pm:1.54	Fri Oct 21 16:03:11 2011
+++ loncom/auth/loncacc.pm	Mon Oct 24 22:39:14 2011
@@ -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.54 2011/10/21 16:03:11 www Exp $
+# $Id: loncacc.pm,v 1.55 2011/10/24 22:39:14 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -75,12 +75,12 @@
 
 =over
 
-=item constructaccess($url,$ownerdomain)
+=item constructaccess($url,$setpriv)
 
 See if the owner domain and name
 in the URL match those in the expected environment.  If so, return 
 two element list ($ownername,$ownerdomain).  Else, return null string.
-
+If 'setpriv' is set to 'setpriv', it actually assigns the privileges.
 =back
 
 =cut
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.241 loncom/interface/lonmeta.pm:1.242
--- loncom/interface/lonmeta.pm:1.241	Sat Oct 22 22:16:07 2011
+++ loncom/interface/lonmeta.pm	Mon Oct 24 22:39:18 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.241 2011/10/22 22:16:07 www Exp $
+# $Id: lonmeta.pm,v 1.242 2011/10/24 22:39:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -874,7 +874,7 @@
     $uri = &Apache::lonnet::declutter($uri);
     $r->print('<h1>'.&Apache::lonnet::clutter($uri).'</h1>');
     my ($domain,$author)=($uri=~/^($match_domain)\/($match_username)\//);
-    if (&Apache::loncacc::constructaccess('/~'.$author.'/',$domain)) {
+    if (&Apache::loncacc::constructaccess('/priv/'.$domain.'/'.$author.'/')) {
 	if ($env{'form.clearbombs'}) {
 	    &Apache::lonmsg::clear_author_res_msg($uri);
 	}
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.110 loncom/publisher/loncfile.pm:1.111
--- loncom/publisher/loncfile.pm:1.110	Sun Oct 23 23:46:07 2011
+++ loncom/publisher/loncfile.pm	Mon Oct 24 22:39:21 2011
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.110 2011/10/23 23:46:07 www Exp $
+# $Id: loncfile.pm,v 1.111 2011/10/24 22:39:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -189,8 +189,7 @@
 sub obsolete_unpub {
     my ($user,$domain,$construct)=@_;
     my $published=$construct;
-    $published=~
-	s/^\/home\/$user\/public\_html\//\/home\/httpd\/html\/res\/$domain\/$user\//;
+    $published=~s/^\/home\/httpd\/html\/priv\//\/home\/httpd\/html\/res\//;
     if (-e $published) {
 	if (&Apache::lonnet::metadata($published,'obsolete')) {
 	    return 1;
@@ -404,16 +403,10 @@
     while ($newfilename=~m:/\.\./:) {
 	$newfilename=~ s:/[^/]+/\.\./:/:g; #remove dir/..
     }
-    if ($newfilename =~ m{^/home/($match_username)/(?:public\_html|priv)/}) {
-        my $otheruname = $1;
-        unless ($otheruname eq $uname) {
-            my ($authorname,$authordom)=
-                &Apache::loncacc::constructaccess($newfilename,$env{'request.role.domain'});
-            unless (($authorname eq $otheruname) && ($authordom ne '')) {
-                my $otherdir = &display($newfilename);
-                $error = &mt('Access denied to [_1]',$otherdir);
-            }
-        }
+    my ($authorname,$authordom)=&Apache::loncacc::constructaccess($newfilename);
+    unless (($authorname) && ($authordom)) {
+       my $otherdir = &display($newfilename);
+       $error = &mt('Access denied to [_1]',$otherdir);
     }
     return ($newfilename,$error);
 }
@@ -1445,8 +1438,7 @@
     my $uname;
     my $udom;
 
-    ($uname,$udom)=
-	&Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain'));
+    ($uname,$udom)=&Apache::loncacc::constructaccess($fn);
     &Debug($r, 
 	   "loncfile::handler constructaccess uname = $uname domain = $udom");
     unless (($uname) && ($udom)) {
Index: loncom/publisher/loncleanup.pm
diff -u loncom/publisher/loncleanup.pm:1.12 loncom/publisher/loncleanup.pm:1.13
--- loncom/publisher/loncleanup.pm:1.12	Sun Oct 23 23:46:07 2011
+++ loncom/publisher/loncleanup.pm	Mon Oct 24 22:39:21 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to cleanup XML files
 #
-# $Id: loncleanup.pm,v 1.12 2011/10/23 23:46:07 www Exp $
+# $Id: loncleanup.pm,v 1.13 2011/10/24 22:39:21 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -407,8 +407,7 @@
     my $uname;
     my $udom;
 
-    ($uname,$udom)=
-	&Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain'));
+    ($uname,$udom)=&Apache::loncacc::constructaccess($fn);
     unless (($uname) && ($udom)) {
 	$r->log_reason($uname.' at '.$udom.
 		       ' trying to cleanup file '.$env{'form.filename'}.
@@ -451,9 +450,9 @@
         '</form>'
        .&Apache::lonhtmlcommon::start_funclist()
        .&Apache::lonhtmlcommon::add_item_funclist(
-            '<a href="/priv/'.$uname.'/'.$fn.'">'.&mt('Back to Source File').'</a>')
+            '<a href="/priv/'.$udom.'/'.$uname.'/'.$fn.'">'.&mt('Back to Source File').'</a>')
        .&Apache::lonhtmlcommon::add_item_funclist(
-            '<a href="/priv/'.$uname.'/'.$dir.'">'.&mt('Back to Source Directory').'</a>')
+            '<a href="/priv/'.$udom.'/'.$uname.'/'.$dir.'">'.&mt('Back to Source Directory').'</a>')
        .&Apache::lonhtmlcommon::end_funclist()
        .&Apache::loncommon::end_page()
     );




More information about the LON-CAPA-cvs mailing list