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

musolffc musolffc at source.lon-capa.org
Wed Mar 19 12:20:36 EDT 2014


musolffc		Wed Mar 19 16:20:36 2014 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  Goes back to using lonnet::allowed to check the status of the first resource.  The first resource can now also be external with an appended query.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.298 loncom/auth/lonroles.pm:1.299
--- loncom/auth/lonroles.pm:1.298	Fri Feb 28 19:19:41 2014
+++ loncom/auth/lonroles.pm	Wed Mar 19 16:20:36 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.298 2014/02/28 19:19:41 bisitz Exp $
+# $Id: lonroles.pm,v 1.299 2014/03/19 16:20:36 musolffc Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -664,11 +664,22 @@
 					}
 				    }
 				}
-# Are we allowed to look at the first resource?
-				if ($furl !~ m|^/adm/|) {
-# Guess not ...
-				    $furl=&Apache::lonpageflip::first_accessible_resource();
-				}
+
+                                # If it's an external resource, 
+                                if ($furl =~ m{^(/adm/wrapper|)/ext/}) {
+                                    # strip off the symb argument and possible query
+                                    my ($exturl,$symb) = ($furl =~ m{^(.+)(?:\?|\&)symb=(.+)$});
+                                    # Unencode $symb
+                                    $symb = &unescape($symb);
+                                    # Then check for permission
+                                    if (!&Apache::lonnet::allowed('bre',$exturl,$symb)) {
+                                        $furl = &Apache::lonpageflip::first_accessible_resource();
+                                    }
+                                # For local resources just check for permission
+                                } elsif (!&Apache::lonnet::allowed('bre',$furl)) {
+                                    $furl = &Apache::lonpageflip::first_accessible_resource();
+                                }
+ 
                                 $msg = &mt('Entering [_1] ...',
 					   $env{'course.'.$cdom.'_'.$cnum.'.description'});
 				&redirect_user($r, &mt('Entering [_1]',




More information about the LON-CAPA-cvs mailing list