--- loncom/auth/publiccheck.pm 2006/11/23 01:49:41 1.11 +++ loncom/auth/publiccheck.pm 2007/10/02 01:09:59 1.15 @@ -1,7 +1,7 @@ # The LearningOnline Network # Cookie Based Access Handler # -# $Id: publiccheck.pm,v 1.11 2006/11/23 01:49:41 albertel Exp $ +# $Id: publiccheck.pm,v 1.15 2007/10/02 01:09:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -34,25 +34,25 @@ use Apache::Constants qw(:common :http : use Apache::lonnet; use Apache::loncommon(); use Apache::lonlocal; -use CGI::Cookie(); use Fcntl qw(:flock); use Apache::lonacc(); +use LONCAPA(); sub handler { my $r = shift; my $requrl=$r->uri; - my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); - my $lonid=$cookies{'lonID'}; - if ($lonid) { - my $handle=&LONCAPA::clean_handle($lonid->value); + if (&Apache::lonnet::is_domainimage($requrl)) { + return OK; + } + + my $handle = &Apache::lonnet::check_for_valid_session($r); + if ($handle ne '') { my $lonidsdir=$r->dir_config('lonIDsDir'); - if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { - &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); - if ($env{'user.name'} ne 'public' - && $env{'user.domain'} ne 'public') { - return OK; - } + &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); + if ($env{'user.name'} ne 'public' + && $env{'user.domain'} ne 'public') { + return OK; } } if ($requrl=~m|^/public/| @@ -72,6 +72,9 @@ sub handler { } elsif ($requrl eq '/adm/restrictedaccess') { &process_public($r,$requrl); return OK; + } elsif ($requrl eq '/adm/blockedaccess') { + &process_public($r,$requrl); + return OK; } return DECLINED; }