Annotation of loncom/auth/lonacc.pm, revision 1.88
1.1 albertel 1: # The LearningOnline Network
2: # Cookie Based Access Handler
1.22 www 3: #
1.88 ! albertel 4: # $Id: lonacc.pm,v 1.87 2006/07/17 19:49:14 albertel Exp $
1.22 www 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.25 harris41 28: ###
1.1 albertel 29:
30: package Apache::lonacc;
31:
32: use strict;
1.8 www 33: use Apache::Constants qw(:common :http :methods);
1.2 www 34: use Apache::File;
1.6 www 35: use Apache::lonnet;
1.25 harris41 36: use Apache::loncommon();
1.47 www 37: use Apache::lonlocal;
1.86 albertel 38: use Apache::restrictedaccess();
1.1 albertel 39: use CGI::Cookie();
1.16 www 40: use Fcntl qw(:flock);
1.85 raeburn 41: use LONCAPA;
1.1 albertel 42:
1.75 albertel 43: sub cleanup {
44: my ($r)=@_;
45: if (! $r->is_initial_req()) { return DECLINED; }
46: &Apache::lonnet::save_cache();
47: return OK;
48: }
49:
50: sub goodbye {
51: my ($r)=@_;
52: &Apache::lonnet::goodbye();
53: return DONE;
54: }
55:
1.76 albertel 56: ###############################################
57:
58: sub get_posted_cgi {
59: my ($r) = @_;
60:
61: my $buffer;
62: if ($r->header_in('Content-length')) {
63: $r->read($buffer,$r->header_in('Content-length'),0);
64: }
65: unless ($buffer=~/^(\-+\w+)\s+Content\-Disposition\:\s*form\-data/si) {
66: my @pairs=split(/&/,$buffer);
67: my $pair;
68: foreach $pair (@pairs) {
69: my ($name,$value) = split(/=/,$pair);
70: $value =~ tr/+/ /;
71: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
72: $name =~ tr/+/ /;
73: $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
1.77 albertel 74: &Apache::loncommon::add_to_env("form.$name",$value);
1.76 albertel 75: }
76: } else {
77: my $contentsep=$1;
78: my @lines = split (/\n/,$buffer);
79: my $name='';
80: my $value='';
81: my $fname='';
82: my $fmime='';
83: my $i;
84: for ($i=0;$i<=$#lines;$i++) {
85: if ($lines[$i]=~/^$contentsep/) {
86: if ($name) {
87: chomp($value);
88: if ($fname) {
89: $env{"form.$name.filename"}=$fname;
90: $env{"form.$name.mimetype"}=$fmime;
91: } else {
92: $value=~s/\s+$//s;
93: }
1.77 albertel 94: &Apache::loncommon::add_to_env("form.$name",$value);
1.76 albertel 95: }
96: if ($i<$#lines) {
97: $i++;
98: $lines[$i]=~
99: /Content\-Disposition\:\s*form\-data\;\s*name\=\"([^\"]+)\"/i;
100: $name=$1;
101: $value='';
102: if ($lines[$i]=~/filename\=\"([^\"]+)\"/i) {
103: $fname=$1;
104: if
105: ($lines[$i+1]=~/Content\-Type\:\s*([\w\-\/]+)/i) {
106: $fmime=$1;
107: $i++;
108: } else {
109: $fmime='';
110: }
111: } else {
112: $fname='';
113: $fmime='';
114: }
115: $i++;
116: }
117: } else {
118: $value.=$lines[$i]."\n";
119: }
120: }
121: }
122: #
123: # Digested POSTed values
124: #
125: # Remember the way this was originally done (GET or POST)
126: #
127: $env{'request.method'}=$ENV{'REQUEST_METHOD'};
128: #
129: # There may also be stuff in the query string
130: # Tell subsequent handlers that this was GET, not POST, so they can access query string.
131: # Also, unset POSTed content length to cover all tracks.
132: #
133:
134: $r->method_number(M_GET);
135:
136: $r->method('GET');
137: $r->headers_in->unset('Content-length');
138: }
139:
1.79 raeburn 140: sub portfolio_access {
1.87 albertel 141: my ($r,$requrl) = @_;
1.88 ! albertel 142: my $access=&Apache::lonnet::allowed('bre',$requrl);
! 143: if ($access eq '2' || $access eq 'F') {
! 144: return OK;
! 145: }
1.87 albertel 146: my (undef,$udom,$unum,$file_name,$group) = &parse_portfolio_url($requrl);
147: my $result = &get_portfolio_access($udom,$unum,$file_name,$group);
1.88 ! albertel 148: &Apache::lonnet::logthis("got pa of $result");
1.87 albertel 149: if ($result eq 'ok') {
150: return OK;
151: } elsif ($result =~ /^[^:]+:guest_/) {
1.88 ! albertel 152: &Apache::lonnet::logthis("doign pac $result");
1.87 albertel 153: &passphrase_access_checker($r,$result,$requrl);
154: return OK;
155: }
1.88 ! albertel 156: return undef;
1.87 albertel 157: }
158:
159: sub get_portfolio_access {
1.79 raeburn 160: my ($udom,$unum,$file_name,$group) = @_;
1.87 albertel 161:
1.79 raeburn 162: my $current_perms = &Apache::lonnet::get_portfile_permissions($udom,$unum);
163: my %access_controls = &Apache::lonnet::get_access_controls(
164: $current_perms,$group,$file_name);
1.81 raeburn 165: my ($public,$guest,@domains,@users,@courses,@groups);
1.79 raeburn 166: my $now = time;
167: my $access_hash = $access_controls{$file_name};
168: if (ref($access_hash) eq 'HASH') {
169: foreach my $key (keys(%{$access_hash})) {
170: my ($num,$scope,$end,$start) = ($key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/);
171: if ($start > $now) {
172: next;
173: }
174: if ($end && $end<$now) {
175: next;
176: }
177: if ($scope eq 'public') {
178: $public = $key;
179: last;
1.81 raeburn 180: } elsif ($scope eq 'guest') {
181: $guest = $key;
182: } elsif ($scope eq 'domains') {
183: push(@domains,$key);
184: } elsif ($scope eq 'users') {
185: push(@users,$key);
186: } elsif ($scope eq 'course') {
187: push(@courses,$key);
188: } elsif ($scope eq 'group') {
189: push(@groups,$key);
1.79 raeburn 190: }
191: }
192: if ($public) {
193: return 'ok';
194: }
1.81 raeburn 195: if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
196: if ($guest) {
1.85 raeburn 197: return $guest;
1.81 raeburn 198: }
199: } else {
200: if (@domains > 0) {
201: foreach my $domkey (@domains) {
1.88 ! albertel 202: if (ref($access_hash->{$domkey}{'dom'}) eq 'ARRAY') {
! 203: if (grep(/^\Q$env{'user.domain'}\E$/,@{$access_hash->{$domkey}{'dom'}})) {
1.81 raeburn 204: return 'ok';
205: }
206: }
207: }
208: }
209: if (@users > 0) {
210: foreach my $userkey (@users) {
1.88 ! albertel 211: if (exists($access_hash->{$userkey}{'users'}{$env{'user.name'}.':'.$env{'user.domain'}})) {
1.81 raeburn 212: return 'ok';
213: }
214: }
215: }
216: my %roleshash;
217: my @courses_and_groups = @courses;
218: push(@courses_and_groups,@groups);
219: if (@courses_and_groups > 0) {
220: my (%allgroups,%allroles);
221: my ($start,$end,$role,$sec,$group);
222: foreach my $envkey (%env) {
223: if ($envkey =~ m-^user\.role\.(gr|cc|in|ta|ep|st)\./([^/]+)/([^/]+)/?([^/]*)$-) {
224: my $cid = $2.'_'.$3;
225: if ($1 eq 'gr') {
226: $group = $4;
227: $allgroups{$cid}{$group} = $env{$envkey};
228: } else {
229: if ($4 eq '') {
230: $sec = 'none';
231: } else {
232: $sec = $4;
233: }
234: $allroles{$cid}{$1}{$sec} = $env{$envkey};
235: }
236: } elsif ($envkey =~ m-^user\.role\./cr/(\w+/\w+/\w*)./([^/]+)/([^/]+)/?([^/]*)$-) {
237: my $cid = $2.'_'.$3;
238: if ($4 eq '') {
239: $sec = 'none';
240: } else {
241: $sec = $4;
242: }
243: $allroles{$cid}{$1}{$sec} = $env{$envkey};
244: }
245: }
246: if (keys(%allroles) == 0) {
247: return;
248: }
249: foreach my $key (@courses_and_groups) {
1.88 ! albertel 250: my %content = %{$$access_hash{$key}};
1.81 raeburn 251: my $cnum = $content{'number'};
252: my $cdom = $content{'domain'};
253: my $cid = $cdom.'_'.$cnum;
254: if (!exists($allroles{$cid})) {
255: next;
256: }
257: foreach my $role_id (keys(%{$content{'roles'}})) {
258: my @sections = @{$content{'roles'}{$role_id}{'section'}};
259: my @groups = @{$content{'roles'}{$role_id}{'group'}};
260: my @status = @{$content{'roles'}{$role_id}{'access'}};
261: my @roles = @{$content{'roles'}{$role_id}{'role'}};
262: foreach my $role (keys(%{$allroles{$cid}})) {
263: if ((grep/^all$/,@roles) || (grep/^\Q$role\E$/,@roles)) {
264: foreach my $sec (keys(%{$allroles{$cid}{$role}})) {
265: if (&course_group_datechecker($allroles{$cid}{$role}{$sec},$now,\@status) eq 'ok') {
266: if (grep/^all$/,@sections) {
267: return 'ok';
268: } else {
269: if (grep/^$sec$/,@sections) {
1.85 raeburn 270: return 'ok';
1.81 raeburn 271: }
272: }
273: }
274: }
275: if (keys(%{$allgroups{$cid}}) == 0) {
276: if (grep/^none$/,@groups) {
277: return 'ok';
278: }
279: } else {
280: if (grep/^all$/,@groups) {
281: return 'ok';
282: }
283: foreach my $group (keys(%{$allgroups{$cid}})) {
284: if (grep/^$group$/,@groups) {
285: return 'ok';
286: }
287: }
288: }
289: }
290: }
291: }
292: }
293: }
294: if ($guest) {
1.85 raeburn 295: return $guest;
1.81 raeburn 296: }
297: }
1.79 raeburn 298: }
299: return;
300: }
1.76 albertel 301:
1.85 raeburn 302: sub passphrase_access_checker {
303: my ($r,$guestkey,$requrl) = @_;
304: my ($num,$scope,$end,$start) = ($guestkey =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/);
305: if ($scope eq 'guest') {
306: if (exists($env{'user.passphrase_access_'.$requrl})) {
307: if (($env{'user.passphrase_access_'.$requrl} == 0) ||
308: ($env{'user.passphrase_access_'.$requrl} > time)) {
309: $env{'request.publicaccess'} = 1;
310: return 'ok';
311: }
312: }
313: }
1.86 albertel 314: $r->set_handlers('PerlHandler'=> \&Apache::restrictedaccess::handler);
315: $r->content_type('perl-script');
1.85 raeburn 316: return;
317: }
318:
1.81 raeburn 319: sub course_group_datechecker {
320: my ($dates,$now,$status) = @_;
321: my ($start,$end) = split(/\./,$dates);
322: if (!$start && !$end) {
323: return 'ok';
324: }
325: if (grep/^active$/,@{$status}) {
326: if (((!$start) || ($start && $start <= $now)) && ((!$end) || ($end && $end >= $now))) {
327: return 'ok';
328: }
329: }
330: if (grep/^previous$/,@{$status}) {
331: if ($end > $now ) {
332: return 'ok';
333: }
334: }
335: if (grep/^future$/,@{$status}) {
336: if ($start > $now) {
337: return 'ok';
338: }
339: }
340: return;
341: }
342:
1.87 albertel 343: sub parse_portfolio_url {
344: my ($url) = @_;
345:
346: my ($type,$udom,$unum,$group,$file_name);
347:
348: if ($url =~ m-/+uploaded/([^/]+)/([^/]+)/portfolio(/.+)$-) {
349: $type = 1;
350: $udom = $1;
351: $unum = $2;
352: $file_name = $3;
353: } elsif ($url =~ m-/+uploaded/([^/]+)/([^/]+)/groups/([^/]+)/portfolio/(.+)$-) {
354: $type = 2;
355: $udom = $1;
356: $unum = $2;
357: $group = $3;
358: $file_name = $3.'/'.$4;
359: }
360: if (wantarray) {
361: return ($type,$udom,$unum,$file_name,$group);
362: }
363: return $type;
364: }
365:
366: sub is_portfolio_url {
367: my ($url) = @_;
368: return scalar(&parse_portfolio_url($url));
369: }
370:
1.1 albertel 371: sub handler {
372: my $r = shift;
373: my $requrl=$r->uri;
374: my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
375: my $lonid=$cookies{'lonID'};
376: my $cookie;
1.70 albertel 377: my $lonidsdir=$r->dir_config('lonIDsDir');
378:
379: my $handle;
1.1 albertel 380: if ($lonid) {
1.70 albertel 381: $handle=$lonid->value;
1.1 albertel 382: $handle=~s/\W//g;
1.70 albertel 383: }
384:
1.78 albertel 385: my ($sso_login);
1.70 albertel 386: if ($r->user
387: && (!$lonid || !-e "$lonidsdir/$handle.id" || $handle eq '') ) {
1.78 albertel 388: $sso_login = 1;
1.70 albertel 389: my $domain = $r->dir_config('lonDefDomain');
390: my $home=&Apache::lonnet::homeserver($r->user,$domain);
391: if ($home !~ /(con_lost|no_such_host)/) {
392: $handle=&Apache::lonauth::success($r,$r->user,$domain,
393: $home,'noredirect');
394: $r->header_out('Set-cookie',"lonID=$handle; path=/");
395: }
396: }
397:
1.78 albertel 398: if ($sso_login) {
399: &Apache::lonnet::appenv('request.sso.login' => 1);
400: }
401:
1.70 albertel 402: if ($r->dir_config("lonBalancer") eq 'yes') {
403: $r->set_handlers('PerlResponseHandler'=>
404: [\&Apache::switchserver::handler]);
405: }
406:
407: if ($handle ne '') {
1.1 albertel 408: if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
1.6 www 409:
1.46 www 410: # ------------------------------------------------------ Initialize Environment
411:
412: &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
1.47 www 413:
414: # --------------------------------------------------------- Initialize Language
415:
1.48 www 416: &Apache::lonlocal::get_language_handle($r);
1.46 www 417:
418: # -------------------------------------------------------------- Resource State
1.6 www 419:
1.51 albertel 420: if ($requrl=~/^\/+(res|uploaded)\//) {
1.64 albertel 421: $env{'request.state'} = "published";
1.17 www 422: } else {
1.64 albertel 423: $env{'request.state'} = 'unknown';
1.17 www 424: }
1.64 albertel 425: $env{'request.filename'} = $r->filename;
426: $env{'request.noversionuri'} = &Apache::lonnet::deversion($requrl);
1.6 www 427: # -------------------------------------------------------- Load POST parameters
428:
1.76 albertel 429: &Apache::lonacc::get_posted_cgi($r);
1.6 www 430:
431: # ---------------------------------------------------------------- Check access
1.79 raeburn 432: my $now = time;
1.87 albertel 433: if (&is_portfolio_url($requrl)) {
1.88 ! albertel 434: my $result = &portfolio_access($r,$requrl);
! 435: if (defined($result)) { return $result; }
1.87 albertel 436: }
1.37 albertel 437: if ($requrl!~/^\/adm|public|prtspool\//) {
1.7 www 438: my $access=&Apache::lonnet::allowed('bre',$requrl);
439: if ($access eq '1') {
1.64 albertel 440: $env{'user.error.msg'}="$requrl:bre:0:0:Choose Course";
1.7 www 441: return HTTP_NOT_ACCEPTABLE;
442: }
443: if (($access ne '2') && ($access ne 'F')) {
1.64 albertel 444: $env{'user.error.msg'}="$requrl:bre:1:1:Access Denied";
1.7 www 445: return HTTP_NOT_ACCEPTABLE;
446: }
1.23 www 447: }
1.37 albertel 448: if ($requrl =~ m|^/prtspool/|) {
1.64 albertel 449: my $start='/prtspool/'.$env{'user.name'}.'_'.
450: $env{'user.domain'};
1.37 albertel 451: if ($requrl !~ /^\Q$start\E/) {
1.64 albertel 452: $env{'user.error.msg'}="$requrl:bre:1:1:Access Denied";
1.37 albertel 453: return HTTP_NOT_ACCEPTABLE;
454: }
455: }
1.67 albertel 456: if ($env{'user.name'} eq 'public' &&
457: $env{'user.domain'} eq 'public' &&
458: $requrl !~ m{^/+(res|public)/} &&
1.69 www 459: $requrl !~ m{^/+adm/(help|logout|randomlabel\.png)}) {
1.67 albertel 460: $env{'request.querystring'}=$r->args;
461: $env{'request.firsturl'}=$requrl;
462: return FORBIDDEN;
463: }
1.23 www 464: # ------------------------------------------------------------- This is allowed
1.64 albertel 465: if ($env{'request.course.id'}) {
1.24 www 466: &Apache::lonnet::countacc($requrl);
1.23 www 467: $requrl=~/\.(\w+)$/;
1.39 www 468: if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') ||
1.84 raeburn 469: ($requrl=~/^\/adm\/.*\/(aboutme|navmaps|smppg|bulletinboard)(\?|$)/) ||
1.44 www 470: ($requrl=~/^\/adm\/wrapper\//) ||
1.72 albertel 471: ($requrl=~m|^/adm/coursedocs/showdoc/|) ||
1.53 albertel 472: ($requrl=~m|\.problem/smpedit$|) ||
1.39 www 473: ($requrl=~/^\/public\/.*\/syllabus$/)) {
1.23 www 474: # ------------------------------------- This is serious stuff, get symb and log
1.29 www 475: my $query=$r->args;
476: my $symb;
477: if ($query) {
478: &Apache::loncommon::get_unprocessed_cgi($query,['symb']);
479: }
1.64 albertel 480: if ($env{'form.symb'}) {
481: $symb=&Apache::lonnet::symbclean($env{'form.symb'});
1.72 albertel 482: if ($requrl =~ m|^/adm/wrapper/|
483: || $requrl =~ m|^/adm/coursedocs/showdoc/|) {
1.52 raeburn 484: my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb);
1.63 albertel 485: &Apache::lonnet::symblist($map,$murl => [$murl,$mid],
486: 'last_known' =>[$murl,$mid]);
1.53 albertel 487: } elsif ((&Apache::lonnet::symbverify($symb,$requrl)) ||
488: (($requrl=~m|(.*)/smpedit$|) &&
489: &Apache::lonnet::symbverify($symb,$1))) {
1.50 albertel 490: my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb);
1.74 albertel 491: &Apache::lonnet::symblist($map,$murl => [$murl,$mid],
1.63 albertel 492: 'last_known' =>[$murl,$mid]);
1.31 www 493: } else {
494: $r->log_reason('Invalid symb for '.$requrl.': '.
495: $symb);
1.64 albertel 496: $env{'user.error.msg'}=
1.31 www 497: "$requrl:bre:1:1:Invalid Access";
498: return HTTP_NOT_ACCEPTABLE;
499: }
1.29 www 500: } else {
1.44 www 501: $symb=&Apache::lonnet::symbread($requrl);
1.58 albertel 502: if (&Apache::lonnet::is_on_map($requrl) && $symb &&
1.56 albertel 503: !&Apache::lonnet::symbverify($symb,$requrl)) {
1.58 albertel 504: $r->log_reason('Invalid symb for '.$requrl.': '.$symb);
1.64 albertel 505: $env{'user.error.msg'}=
1.55 albertel 506: "$requrl:bre:1:1:Invalid Access";
507: return HTTP_NOT_ACCEPTABLE;
508: }
1.61 albertel 509: if ($symb) {
1.65 albertel 510: my ($map,$mid,$murl)=
511: &Apache::lonnet::decode_symb($symb);
1.63 albertel 512: &Apache::lonnet::symblist($map,$murl =>[$murl,$mid],
513: 'last_known' =>[$murl,$mid]);
1.61 albertel 514: }
1.29 www 515: }
1.64 albertel 516: $env{'request.symb'}=$symb;
1.23 www 517: &Apache::lonnet::courseacclog($symb);
518: } else {
519: # ------------------------------------------------------- This is other content
520: &Apache::lonnet::courseacclog($requrl);
521: }
522: }
1.2 www 523: return OK;
1.1 albertel 524: } else {
1.73 raeburn 525: $r->log_reason("Cookie $handle not valid", $r->filename);
526: }
1.88 ! albertel 527: }
1.6 www 528:
1.21 www 529: # -------------------------------------------- See if this is a public resource
1.37 albertel 530: if ($requrl=~m|^/public/|
531: || (&Apache::lonnet::metadata($requrl,'copyright') eq 'public')) {
1.21 www 532: &Apache::lonnet::logthis('Granting public access: '.$requrl);
1.71 www 533: &Apache::lonlocal::get_language_handle($r);
1.66 albertel 534: my $cookie=
535: &Apache::lonauth::success($r,'public','public','public');
536: my $lonidsdir=$r->dir_config('lonIDsDir');
537: &Apache::lonnet::transfer_profile_to_env($lonidsdir,$cookie);
1.76 albertel 538: &Apache::lonacc::get_posted_cgi($r);
1.64 albertel 539: $env{'request.state'} = "published";
540: $env{'request.publicaccess'} = 1;
541: $env{'request.filename'} = $r->filename;
1.59 albertel 542:
1.66 albertel 543: $r->header_out('Set-cookie',"lonID=$cookie; path=/");
1.21 www 544: return OK;
545: }
1.68 albertel 546: if ($requrl=~m|^/+adm/+help/+|) {
547: return OK;
548: }
1.79 raeburn 549: # ------------------------------------- See if this is a viewable portfolio file
1.87 albertel 550: if (&is_portfolio_url($requrl)) {
1.88 ! albertel 551: my $result = &portfolio_access($r,$requrl);
! 552: if (defined($result)) { return $result; }
1.79 raeburn 553: }
1.87 albertel 554:
1.34 www 555: # -------------------------------------------------------------- Not authorized
556: $requrl=~/\.(\w+)$/;
1.62 albertel 557: # if ((&Apache::loncommon::fileembstyle($1) eq 'ssi') ||
558: # ($requrl=~/^\/adm\/(roles|logout|email|menu|remote)/) ||
559: # ($requrl=~m|^/prtspool/|)) {
1.34 www 560: # -------------------------- Store where they wanted to go and get login screen
1.64 albertel 561: $env{'request.querystring'}=$r->args;
562: $env{'request.firsturl'}=$requrl;
1.34 www 563: return FORBIDDEN;
1.62 albertel 564: # } else {
1.34 www 565: # --------------------------------------------------------------------- Goodbye
1.62 albertel 566: # return HTTP_BAD_REQUEST;
567: # }
1.1 albertel 568: }
569:
570: 1;
571: __END__
1.25 harris41 572:
573: =head1 NAME
574:
575: Apache::lonacc - Cookie Based Access Handler
576:
577: =head1 SYNOPSIS
578:
579: Invoked (for various locations) by /etc/httpd/conf/srm.conf:
580:
581: PerlAccessHandler Apache::lonacc
582:
583: =head1 INTRODUCTION
584:
585: This module enables cookie based authentication and is used
586: to control access for many different LON-CAPA URIs.
587:
588: Whenever the client sends the cookie back to the server,
589: this cookie is handled by either lonacc.pm or loncacc.pm
590: (see srm.conf for what is invoked when). If
591: the cookie is missing or invalid, the user is re-challenged
592: for login information.
593:
594: This is part of the LearningOnline Network with CAPA project
595: described at http://www.lon-capa.org.
596:
597: =head1 HANDLER SUBROUTINE
598:
599: This routine is called by Apache and mod_perl.
600:
601: =over 4
602:
603: =item *
604:
605: transfer profile into environment
606:
607: =item *
608:
609: load POST parameters
610:
611: =item *
612:
613: check access
614:
615: =item *
616:
617: if allowed, get symb, log, generate course statistics if applicable
618:
619: =item *
620:
621: otherwise return error
622:
623: =item *
624:
625: see if public resource
626:
627: =item *
628:
629: store attempted access
630:
631: =back
632:
633: =cut
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>