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