Skip to content

Commit

Permalink
make it configurable which authentication modules can be used for the…
Browse files Browse the repository at this point in the history
… admin course
  • Loading branch information
Alex-Jordan committed Dec 23, 2023
1 parent 3f80344 commit 4782edd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 12 additions & 2 deletions conf/defaults.config
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,25 @@ $modelCoursesForCopy = [ "modelCourse" ];
#
#
$authen{user_module} = {
# sql_moodle => "WeBWorK::Authen::Moodle",
# sql_ldap => "WeBWorK::Authen::LDAP",
#sql_moodle => "WeBWorK::Authen::Moodle",
#sql_moodle => "WeBWorK::Authen::Moodle",
"*" => "WeBWorK::Authen::Basic_TheLastOption",
};

# Select the authentication module to use for proctor logins.
# A string or a hash is accepted, as above.
$authen{proctor_module} = "WeBWorK::Authen::Proctor";

# Authentication modules that may be used to enter the admin course.
# If additional authentication modules are included in $authen{user_module}
# (either in localOverrides.conf or within config files for those modules)
# then consideration should be made about whether to include those modules for
# entry into the admin course (again either in localOverrides.conf or within
# config files for those modules).
$authen{admin_module} = [
'WeBWorK::Authen::Basic_TheLastOption'
];

################################################################################
# Authorization system (Make local overrides in localOverrides.conf )
################################################################################
Expand Down
5 changes: 3 additions & 2 deletions lib/WeBWorK/Authen.pm
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,9 @@ sub verify {
return ($self->call_next_authen_method());
}

if ($c->ce->{courseName} eq 'admin' && ref($c->authen) =~ /LTI/) {
$c->stash(authen_error => maketext('Cannot authenticate into admin course using LTI authentication.'));
my $authen_ref = ref($c->authen);
if ($c->ce->{courseName} eq 'admin' && !(grep(/^$authen_ref$/, @{ $c->ce->{admin_module} }))) {
$c->stash(authen_error => maketext("Cannot authenticate into admin course using $authen_ref."));
return ($self->call_next_authen_method());
}

Expand Down

0 comments on commit 4782edd

Please sign in to comment.