Authentication modules are now configured from the config file rather than the command line.

This commit is contained in:
JT Smith 2003-02-27 04:45:56 +00:00
parent 7bca02db6d
commit 71d0d6b0c7
5 changed files with 30 additions and 33 deletions

View file

@ -79,16 +79,15 @@ sub _submenu {
#-------------------------------------------------------------------
sub www_addInternationalMessage {
my ($output,$f,$namespace);
my ($output,$f);
return WebGUI::Privilege::adminOnly() unless (WebGUI::Privilege::isInGroup(3));
$output = '<h1>Add English Message</h1>';
$namespace = $session{wobject};
$namespace->{WebGUI} = 'WebGUI';
$namespace = {%{$namespace}, map {'Auth/'.$_ => 'Authentication: '.$session{authentication}->{$_}} keys(%{$session{authentication}})};
$f = WebGUI::HTMLForm->new();
$f->hidden("lid",1);
$f->hidden("op","addInternationalMessageSave");
$f->select("namespace",$namespace,"Namespace",['WebGUI']);
$f->combo("namespace",
WebGUI::SQL->buildHashRef("select namespace,namespace from international where language=1 order by namespace")
,"Namespace",['WebGUI']);
$f->textarea("message","Message");
$f->submit;
$output .= $f->print;

View file

@ -50,8 +50,11 @@ sub www_editUserSettings {
$f->integer("karmaPerLogin",WebGUI::International::get(540),$session{setting}{karmaPerLogin});
$f->interval("sessionTimeout",WebGUI::International::get(142),WebGUI::DateTime::secondsToInterval($session{setting}{sessionTimeout}));
$f->yesNo("selfDeactivation",WebGUI::International::get(885),$session{setting}{selfDeactivation});
$f->select("authMethod",$session{authentication},WebGUI::International::get(119),[$session{setting}{authMethod}]);
foreach (keys %{$session{authentication}}) {
foreach (@{$session{config}{authMethods}}) {
$options->{$_} = $_;
}
$f->select("authMethod",$options,WebGUI::International::get(119),[$session{setting}{authMethod}]);
foreach (@{$session{config}{authMethods}}) {
$f->raw(WebGUI::Authentication::settingsForm($_));
}
$f->submit;

View file

@ -82,8 +82,12 @@ sub www_addUser {
-size=>5,
-multiple=>1
);
$f->select("authMethod",$session{authentication},WebGUI::International::get(164),[$session{setting}{authMethod}]);
foreach (keys %{$session{authentication}}) {
my $options;
foreach (@{$session{config}{authMethods}}) {
$options->{$_} = $_;
}
$f->select("authMethod",$options,WebGUI::International::get(164),[$session{setting}{authMethod}]);
foreach (@{$session{config}{authMethods}}) {
$f->raw(WebGUI::Authentication::adminForm(0,$_));
}
$f->submit;
@ -101,7 +105,7 @@ sub www_addUserSave {
$u = WebGUI::User->new("new");
$session{form}{uid}=$u->userId;
$u->username($session{form}{username});
foreach (keys %{$session{authentication}}) {
foreach (@{$session{config}{authMethods}}) {
WebGUI::Authentication::adminFormSave($u->userId,$_);
}
$u->status($session{form}{status});
@ -232,8 +236,12 @@ sub www_editUser {
} else {
$f->select("status",\%status,WebGUI::International::get(816),[$u->status]);
}
$f->select("authMethod",$session{authentication},WebGUI::International::get(164),[$u->authMethod]);
foreach (keys %{$session{authentication}}) {
my $options;
foreach (@{$session{config}{authMethods}}) {
$options->{$_} = $_;
}
$f->select("authMethod",$options,WebGUI::International::get(164),[$u->authMethod]);
foreach (@{$session{config}{authMethods}}) {
$f->raw(WebGUI::Authentication::adminForm($u->userId,$_));
}
$f->submit;
@ -251,7 +259,7 @@ sub www_editUserSave {
$u->username($session{form}{username});
$u->authMethod($session{form}{authMethod});
$u->status($session{form}{status});
foreach (keys %{$session{authentication}}) {
foreach (@{$session{config}{authMethods}}) {
WebGUI::Authentication::adminFormSave($u->userId,$_);
}
} else {

View file

@ -165,28 +165,13 @@ sub _time {
#-------------------------------------------------------------------
sub _loadAuthentication {
my ($dir, @files, $file, $cmd, $namespace, $exclude);
$dir = $session{config}{webguiRoot}.$session{os}{slash}."lib".$session{os}{slash}."WebGUI".$session{os}{slash}."Authentication";
opendir (DIR,$dir) or WebGUI::ErrorHandler::fatalError("Can't open Authentication module directory!");
@files = readdir(DIR);
foreach $file (@files) {
if ($file =~ /(.*?)\.pm$/) {
$namespace = $1;
$cmd = "use WebGUI::Authentication::".$namespace;
eval($cmd);
unless ($@) {
$exclude = $session{config}{excludeAuthentication};
$exclude =~ s/ //g;
unless (isIn($namespace, split(/,/,$exclude))) {
$session{authentication}{$namespace} = $namespace;
}
} else {
WebGUI::ErrorHandler::warn("Authentication module failed to compile: $namespace. ".$@);
$session{authentication}{failed} .= "[".$namespace."] ";
}
foreach my $namespace (@{$session{config}{authMethods}}) {
my $cmd = "use WebGUI::Authentication::".$namespace;
eval($cmd);
if ($@) {
WebGUI::ErrorHandler::warn("Authentication module failed to compile: $namespace. ".$@);
}
}
closedir(DIR);
}
#-------------------------------------------------------------------