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

raeburn raeburn at source.lon-capa.org
Wed Feb 8 01:35:32 EST 2017


raeburn		Wed Feb  8 06:35:32 2017 EDT

  Modified files:              
    /loncom/auth	lonuploadedacc.pm 
  Log:
  - Display student photos when using Apache 2.4
    PerlAuthenHandler needs to set $r->user() for requests for <LocationMatch>
    directives which include Require valid-user.
  
  
Index: loncom/auth/lonuploadedacc.pm
diff -u loncom/auth/lonuploadedacc.pm:1.15 loncom/auth/lonuploadedacc.pm:1.16
--- loncom/auth/lonuploadedacc.pm:1.15	Thu Nov 20 15:19:22 2008
+++ loncom/auth/lonuploadedacc.pm	Wed Feb  8 06:35:31 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Access Handler for User Files
 #
-# $Id: lonuploadedacc.pm,v 1.15 2008/11/20 15:19:22 jms Exp $
+# $Id: lonuploadedacc.pm,v 1.16 2017/02/08 06:35:31 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -34,6 +34,7 @@
 use strict;
 use Apache::Constants qw(:common :http);
 use Apache::lonnet;
+use LONCAPA qw(:match);
 
 sub handler {
     my $r = shift;
@@ -46,6 +47,21 @@
                  $udom.'/'.$uname.'/'.$ufile.':'.$env{'form.token'},
 				     $remoteserver);
     if ($reply eq 'ok') {
+       if (($r->user() eq '') && ($env{'form.token'} ne '')) {
+           my ($cuname,$cudom) = 
+               ($env{'form.token'} =~ /^($match_username)_\d+_($match_domain)_/); 
+           if ($cuname ne '') {
+               if ($cudom eq $r->dir_config('lonDefDomain')) {
+                   $r->user($cuname);
+               } else {
+                   $r->user($cuname.':'.$cudom);
+               }
+           } else {
+               $r->user('public:public');
+           }
+       } else {
+           $r->user('public:public');
+       }
        return OK;
    } elsif ($reply eq 'con_lost' || $reply eq 'no_such_host') {
        &Apache::lonnet::logthis("Server unavailable for userfile access $uname at $udom for $ufile with $remoteserver token $env{'form.token'}: $reply");




More information about the LON-CAPA-cvs mailing list