--- loncom/auth/lonuploadedacc.pm 2008/11/20 15:19:22 1.15 +++ loncom/auth/lonuploadedacc.pm 2017/02/08 06:35:31 1.16 @@ -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 @@ package Apache::lonuploadedacc; use strict; use Apache::Constants qw(:common :http); use Apache::lonnet; +use LONCAPA qw(:match); sub handler { my $r = shift; @@ -46,6 +47,21 @@ sub handler { $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");