| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork2/lib/WeBWorK.pm,v 1.81 2006/02/03 18:21:26 sh002i Exp $ |
4 | # $CVSHeader: webwork2/lib/WeBWorK.pm,v 1.82 2006/04/12 18:50:37 sh002i Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 44 | # load WeBWorK::Constants before anything else |
44 | # load WeBWorK::Constants before anything else |
| 45 | # this sets package variables in several packages |
45 | # this sets package variables in several packages |
| 46 | use WeBWorK::Constants; |
46 | use WeBWorK::Constants; |
| 47 | |
47 | |
| 48 | # the rest of these are modules that are acutally used by this one |
48 | # the rest of these are modules that are acutally used by this one |
| 49 | use WeBWorK::Authen; |
49 | #use WeBWorK::Authen; |
| 50 | use WeBWorK::Authen::Proctor; |
50 | #use WeBWorK::Authen::Proctor; |
| 51 | use WeBWorK::Authz; |
51 | use WeBWorK::Authz; |
| 52 | use WeBWorK::CourseEnvironment; |
52 | use WeBWorK::CourseEnvironment; |
| 53 | use WeBWorK::DB; |
53 | use WeBWorK::DB; |
| 54 | use WeBWorK::Debug; |
54 | use WeBWorK::Debug; |
| 55 | use WeBWorK::Request; |
55 | use WeBWorK::Request; |
| … | |
… | |
| 195 | # create these out here. they should fail if they don't have the right information |
195 | # create these out here. they should fail if they don't have the right information |
| 196 | # this lets us not be so careful about whether these objects are defined when we use them. |
196 | # this lets us not be so careful about whether these objects are defined when we use them. |
| 197 | # instead, we just create the behavior that if they don't have a valid $db they fail. |
197 | # instead, we just create the behavior that if they don't have a valid $db they fail. |
| 198 | my $authz = new WeBWorK::Authz($r); |
198 | my $authz = new WeBWorK::Authz($r); |
| 199 | $r->authz($authz); |
199 | $r->authz($authz); |
| 200 | my $authen = new WeBWorK::Authen($r); |
200 | |
|
|
201 | # figure out which authentication modules to use |
|
|
202 | my $user_authen_module; |
|
|
203 | my $proctor_authen_module; |
|
|
204 | if (ref $ce->{authen}{user_module} eq "HASH") { |
|
|
205 | if (exists $ce->{authen}{user_module}{$ce->{dbLayoutName}}) { |
|
|
206 | $user_authen_module = $ce->{authen}{user_module}{$ce->{dbLayoutName}}; |
|
|
207 | } else { |
|
|
208 | $user_authen_module = $ce->{authen}{user_module}{"*"}; |
|
|
209 | } |
|
|
210 | } else { |
|
|
211 | $user_authen_module = $ce->{authen}{user_module}; |
|
|
212 | } |
|
|
213 | if (ref $ce->{authen}{proctor_module} eq "HASH") { |
|
|
214 | if (exists $ce->{authen}{proctor_module}{$ce->{dbLayoutName}}) { |
|
|
215 | $proctor_authen_module = $ce->{authen}{proctor_module}{$ce->{dbLayoutName}}; |
|
|
216 | } else { |
|
|
217 | $proctor_authen_module = $ce->{authen}{proctor_module}{"*"}; |
|
|
218 | } |
|
|
219 | } else { |
|
|
220 | $proctor_authen_module = $ce->{authen}{proctor_module}; |
|
|
221 | } |
|
|
222 | |
|
|
223 | runtime_use $user_authen_module; |
|
|
224 | my $authen = $user_authen_module->new($r); |
|
|
225 | debug("Using user_authen_module $user_authen_module: $authen\n"); |
| 201 | $r->authen($authen); |
226 | $r->authen($authen); |
| 202 | |
227 | |
| 203 | my $db; |
228 | my $db; |
| 204 | |
229 | |
| 205 | if ($displayArgs{courseID}) { |
230 | if ($displayArgs{courseID}) { |
| … | |
… | |
| 257 | # we need to also check on the proctor. note that in the gateway quiz |
282 | # we need to also check on the proctor. note that in the gateway quiz |
| 258 | # module we double check this, to be sure that someone isn't taking a |
283 | # module we double check this, to be sure that someone isn't taking a |
| 259 | # proctored quiz but calling the unproctored ContentGenerator |
284 | # proctored quiz but calling the unproctored ContentGenerator |
| 260 | my $urlProducedPath = $urlPath->path(); |
285 | my $urlProducedPath = $urlPath->path(); |
| 261 | if ( $urlProducedPath =~ /proctored_quiz_mode/i ) { |
286 | if ( $urlProducedPath =~ /proctored_quiz_mode/i ) { |
| 262 | my $authenProctor = new WeBWorK::Authen::Proctor($r); |
287 | runtime_use $proctor_authen_module; |
|
|
288 | my $authenProctor = $proctor_authen_module->new($r); |
|
|
289 | debug("Using proctor_authen_module $proctor_authen_module: $authenProctor\n"); |
| 263 | my $procAuthOK = $authenProctor->verify(); |
290 | my $procAuthOK = $authenProctor->verify(); |
| 264 | |
291 | |
| 265 | if (not $procAuthOK) { |
292 | if (not $procAuthOK) { |
| 266 | $displayModule = PROCTOR_LOGIN_MODULE; |
293 | $displayModule = PROCTOR_LOGIN_MODULE; |
| 267 | } |
294 | } |
| … | |
… | |
| 337 | } |
364 | } |
| 338 | } |
365 | } |
| 339 | } |
366 | } |
| 340 | } |
367 | } |
| 341 | |
368 | |
| 342 | |
|
|
| 343 | =head1 AUTHOR |
369 | =head1 AUTHOR |
| 344 | |
370 | |
| 345 | Written by Dennis Lambe, malsyned at math.rochester.edu. Modified by Sam |
371 | Written by Dennis Lambe, malsyned at math.rochester.edu. Modified by Sam |
| 346 | Hathaway, sh002i at math.rochester.edu. |
372 | Hathaway, sh002i at math.rochester.edu. |
| 347 | |
373 | |