| 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.86 2006/07/11 03:59:03 sh002i Exp $ |
4 | # $CVSHeader: webwork2/lib/WeBWorK.pm,v 1.88 2006/07/15 14:06:42 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. |
| … | |
… | |
| 42 | |
42 | |
| 43 | # load WeBWorK::Constants before anything else |
43 | # load WeBWorK::Constants before anything else |
| 44 | # this sets package variables in several packages |
44 | # this sets package variables in several packages |
| 45 | use WeBWorK::Constants; |
45 | use WeBWorK::Constants; |
| 46 | |
46 | |
| 47 | # the rest of these are modules that are acutally used by this one |
47 | use WeBWorK::Authen; |
| 48 | use WeBWorK::Authz; |
48 | use WeBWorK::Authz; |
| 49 | use WeBWorK::CourseEnvironment; |
49 | use WeBWorK::CourseEnvironment; |
| 50 | use WeBWorK::DB; |
50 | use WeBWorK::DB; |
| 51 | use WeBWorK::Debug; |
51 | use WeBWorK::Debug; |
| 52 | use WeBWorK::Request; |
52 | use WeBWorK::Request; |
| … | |
… | |
| 222 | # instead, we just create the behavior that if they don't have a valid $db they fail. |
222 | # instead, we just create the behavior that if they don't have a valid $db they fail. |
| 223 | my $authz = new WeBWorK::Authz($r); |
223 | my $authz = new WeBWorK::Authz($r); |
| 224 | $r->authz($authz); |
224 | $r->authz($authz); |
| 225 | |
225 | |
| 226 | # figure out which authentication modules to use |
226 | # figure out which authentication modules to use |
| 227 | my $user_authen_module; |
227 | #my $user_authen_module; |
| 228 | my $proctor_authen_module; |
228 | #my $proctor_authen_module; |
| 229 | if (ref $ce->{authen}{user_module} eq "HASH") { |
229 | #if (ref $ce->{authen}{user_module} eq "HASH") { |
| 230 | if (exists $ce->{authen}{user_module}{$ce->{dbLayoutName}}) { |
230 | # if (exists $ce->{authen}{user_module}{$ce->{dbLayoutName}}) { |
| 231 | $user_authen_module = $ce->{authen}{user_module}{$ce->{dbLayoutName}}; |
231 | # $user_authen_module = $ce->{authen}{user_module}{$ce->{dbLayoutName}}; |
| 232 | } else { |
232 | # } else { |
| 233 | $user_authen_module = $ce->{authen}{user_module}{"*"}; |
233 | # $user_authen_module = $ce->{authen}{user_module}{"*"}; |
| 234 | } |
234 | # } |
| 235 | } else { |
235 | #} else { |
| 236 | $user_authen_module = $ce->{authen}{user_module}; |
236 | # $user_authen_module = $ce->{authen}{user_module}; |
| 237 | } |
237 | #} |
| 238 | if (ref $ce->{authen}{proctor_module} eq "HASH") { |
238 | #if (ref $ce->{authen}{proctor_module} eq "HASH") { |
| 239 | if (exists $ce->{authen}{proctor_module}{$ce->{dbLayoutName}}) { |
239 | # if (exists $ce->{authen}{proctor_module}{$ce->{dbLayoutName}}) { |
| 240 | $proctor_authen_module = $ce->{authen}{proctor_module}{$ce->{dbLayoutName}}; |
240 | # $proctor_authen_module = $ce->{authen}{proctor_module}{$ce->{dbLayoutName}}; |
| 241 | } else { |
241 | # } else { |
| 242 | $proctor_authen_module = $ce->{authen}{proctor_module}{"*"}; |
242 | # $proctor_authen_module = $ce->{authen}{proctor_module}{"*"}; |
| 243 | } |
243 | # } |
| 244 | } else { |
244 | #} else { |
| 245 | $proctor_authen_module = $ce->{authen}{proctor_module}; |
245 | # $proctor_authen_module = $ce->{authen}{proctor_module}; |
| 246 | } |
246 | #} |
|
|
247 | |
|
|
248 | my $user_authen_module = WeBWorK::Authen::class($ce, "user_module"); |
| 247 | |
249 | |
| 248 | runtime_use $user_authen_module; |
250 | runtime_use $user_authen_module; |
| 249 | my $authen = $user_authen_module->new($r); |
251 | my $authen = $user_authen_module->new($r); |
| 250 | debug("Using user_authen_module $user_authen_module: $authen\n"); |
252 | debug("Using user_authen_module $user_authen_module: $authen\n"); |
| 251 | $r->authen($authen); |
253 | $r->authen($authen); |
| … | |
… | |
| 304 | # we need to also check on the proctor. note that in the gateway quiz |
306 | # we need to also check on the proctor. note that in the gateway quiz |
| 305 | # module we double check this, to be sure that someone isn't taking a |
307 | # module we double check this, to be sure that someone isn't taking a |
| 306 | # proctored quiz but calling the unproctored ContentGenerator |
308 | # proctored quiz but calling the unproctored ContentGenerator |
| 307 | my $urlProducedPath = $urlPath->path(); |
309 | my $urlProducedPath = $urlPath->path(); |
| 308 | if ( $urlProducedPath =~ /proctored_quiz_mode/i ) { |
310 | if ( $urlProducedPath =~ /proctored_quiz_mode/i ) { |
|
|
311 | my $proctor_authen_module = WeBWorK::Authen::class($ce, "proctor_module"); |
| 309 | runtime_use $proctor_authen_module; |
312 | runtime_use $proctor_authen_module; |
| 310 | my $authenProctor = $proctor_authen_module->new($r); |
313 | my $authenProctor = $proctor_authen_module->new($r); |
| 311 | debug("Using proctor_authen_module $proctor_authen_module: $authenProctor\n"); |
314 | debug("Using proctor_authen_module $proctor_authen_module: $authenProctor\n"); |
| 312 | my $procAuthOK = $authenProctor->verify(); |
315 | my $procAuthOK = $authenProctor->verify(); |
| 313 | |
316 | |
| 314 | if (not $procAuthOK) { |
317 | if (not $procAuthOK) { |
| 315 | $displayModule = PROCTOR_LOGIN_MODULE; |
318 | $displayModule = PROCTOR_LOGIN_MODULE; |
| 316 | } |
319 | } |