[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /auth lonacc.pm

raeburn raeburn at source.lon-capa.org
Sat Jan 2 17:11:26 EST 2021


raeburn		Sat Jan  2 22:11:26 2021 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/auth	lonacc.pm 
  Log:
  - For 2.11
    Backport 1.186 (part).
  
  
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.159.2.16 loncom/auth/lonacc.pm:1.159.2.17
--- loncom/auth/lonacc.pm:1.159.2.16	Tue Dec 22 23:53:36 2020
+++ loncom/auth/lonacc.pm	Sat Jan  2 22:11:26 2021
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.159.2.16 2020/12/22 23:53:36 raeburn Exp $
+# $Id: lonacc.pm,v 1.159.2.17 2021/01/02 22:11:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -589,11 +589,19 @@
 
 # ---------------------------------------------------------------- Check access
 	my $now = time;
-        my ($check_symb,$check_access);
+        my ($check_symb,$check_access,$check_block,$access,$poss_symb);
 	if ($requrl !~ m{^/(?:adm|public|(?:prt|zip)spool)/}
 	    || $requrl =~ /^\/adm\/.*\/(smppg|bulletinboard)(\?|$ )/x) {
             $check_access = 1;
         }
+        if ((!$check_access) && ($env{'request.course.id'})) {
+            if (($requrl eq '/adm/viewclasslist') ||
+                ($requrl =~ m{^(/adm/wrapper|)\Q/uploaded/$cdom/$cnum/docs/\E}) ||
+                ($requrl =~ m{^/adm/.*/aboutme$}) ||
+                ($requrl=~m{^/adm/coursedocs/showdoc/})) {
+                $check_block = 1;
+            }
+        }
         if (($env{'request.course.id'}) && (!$suppext)) {
             $requrl=~/\.(\w+)$/;
             if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') ||
@@ -607,8 +615,7 @@
                 $check_symb = 1;
             }
         }
-        if ($check_access) {
-            my ($access,$poss_symb);
+        if (($check_access) || ($check_block)) {
             if ($check_symb) {
                 if ($env{'form.symb'}) {
                     $poss_symb=&Apache::lonnet::symbclean($env{'form.symb'});
@@ -628,7 +635,9 @@
                 if ($poss_symb) {
                     my ($possmap,$resid,$url)=&Apache::lonnet::decode_symb($poss_symb);
                     $url = &Apache::lonnet::clutter($url);
-                    unless (($url eq $requrl) && (&Apache::lonnet::is_on_map($possmap))) {
+                    my $toplevelmap = $env{'course.'.$env{'request.course.id'}.'.url'};
+                    unless (($url eq $requrl) && (($possmap eq $toplevelmap) ||
+                                                  (&Apache::lonnet::is_on_map($possmap)))) {
                         undef($poss_symb);
                     }
                     if ($poss_symb) {
@@ -646,6 +655,18 @@
             } else {
                 $access=&Apache::lonnet::allowed('bre',$requrl);
             }
+        }
+        if ($check_block) {
+            if ($access eq 'B') {
+                if ($poss_symb) {
+                    if (&Apache::lonnet::symbverify($poss_symb,$requrl)) {
+                        $env{'request.symb'} = $poss_symb;
+                    }
+                }
+                &Apache::blockedaccess::setup_handler($r);
+                return OK;
+            }
+        } elsif ($check_access) { 
             if ($handle eq '') {
                 unless ($access eq 'F') {
                     if ($requrl =~ m{^/res/$match_domain/$match_username/}) {
@@ -663,9 +684,6 @@
 	    }
             if ($access eq 'B') {
                 if ($poss_symb) {
-                    if ($requrl=~m{^(/adm/.*/aboutme)/portfolio$}) {
-                        $requrl = $1;
-                    }
                     if (&Apache::lonnet::symbverify($poss_symb,$requrl)) {
                         $env{'request.symb'} = $poss_symb;
                     }




More information about the LON-CAPA-cvs mailing list