some bug fixes

This commit is contained in:
JT Smith 2005-02-14 20:56:51 +00:00
parent 0b07a0dff1
commit 370a708ab9
6 changed files with 14 additions and 284 deletions

View file

@ -79,6 +79,10 @@
- Enhanced the user import script to allow you to update existing accounts,
group expirations, etc, in addition to just importing new accounts. (Nick
Roberts)
- fix [ 1118861 ] WebGUI::Group->find() broken! (fix)
- Removed the long deprecated SMB auth module. It will be added to the user
contribs area in case someone wishes to use/maintain it.
- fix [ 1122377 ] 6.2.9 - USS sequence ordering bugs

View file

@ -77,6 +77,12 @@ save you many hours of grief.
been moved from outside the content system, to inside it as assets
in the new asset tree.
* If you are using the SMB auth module, please note that it has been removed
from this release. It has been long deprecated and is no longer an
official part of WebGUI. It will be made available in the user
contribs section of plainblack.com for people wishing to continue to
use/maintain it.
6.2.10
--------------------------------------------------------------------

View file

@ -72,7 +72,7 @@ sub edit {
}
$tabform->addTab("properties",WebGUI::International::get("properties","Asset"));
$tabform->getTab("properties")->yesNo(
-name=>"hideFromNavigation",
-name=>"isHidden",
-value=>1,
-label=>WebGUI::International::get(886),
-uiLevel=>6

View file

@ -1,273 +0,0 @@
package WebGUI::Auth::SMB;
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
#-------------------------------------------------------------------
# Please read the legal notices (docs/legal.txt) and the license
# (docs/license.txt) that came with this distribution before using
# this software.
#-------------------------------------------------------------------
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
use strict;
use WebGUI::Asset::Template;
use WebGUI::Auth;
use WebGUI::HTMLForm;
use WebGUI::Form;
use WebGUI::Session;
use WebGUI::Utility;
use Authen::Smb;
use warnings;
our @ISA = qw(WebGUI::Auth);
my %smbError = (
1 => WebGUI::International::get(2,'AuthSMB'),
2 => WebGUI::International::get(3,'AuthSMB'),
3 => WebGUI::International::get(4,'AuthSMB')
);
#-------------------------------------------------------------------
=head2 addUserForm ( )
Creates user form elements specific to this Auth Method.
=cut
sub addUserForm {
my $self = shift;
my $userData = $self->getParams;
my $pdc = $session{form}{'authSMB.smbPDC'} || $userData->{smbPDC} || $session{setting}{smbPDC};
my $bdc = $session{form}{'authSMB.smbBDC'} || $userData->{smbBDC} || $session{setting}{smbBDC};
my $domain = $session{form}{'authSMB.smbDomain'} || $userData->{smbDomain} || $session{setting}{smbDomain};
my $login = $session{form}{'authSMB.smbLogin'} || $userData->{smbLogin};
my $f = WebGUI::HTMLForm->new;
$f->text("authSMB.smbPDC",WebGUI::International::get(5,'AuthSMB'),$pdc);
$f->text("authSMB.smbBDC",WebGUI::International::get(6,'AuthSMB'),$bdc);
$f->text("authSMB.smbDomain",WebGUI::International::get(7,'AuthSMB'),$domain);
$f->text("authSMB.smbLogin",WebGUI::International::get(8,'AuthSMB'),$login);
return $f->printRowsOnly;
}
#-------------------------------------------------------------------
=head2 addUserFormSave ( )
Saves user elements unique to this authentication method
=cut
sub addUserFormSave {
my $self = shift;
my $properties;
$properties->{smbPDC} = $session{form}{'authSMB.smbPDC'};
$properties->{smbBDC} = $session{form}{'authSMB.smbBDC'};
$properties->{smbDomain} = $session{form}{'authSMB.smbDomain'};
$properties->{smbLogin} = $session{form}{'authSMB.smbLogin'};
$self->SUPER::addUserFormSave($properties);
}
#-------------------------------------------------------------------
sub authenticate {
my $self = shift;
my ($smb, $error);
return 0 if !$self->SUPER::authenticate($_[0]); #authenticate that the username entered actually exists and is active
my $userId = $self->userId;
my $password = $_[1];
my $userData = $self->getParams;
if($userData->{smbLogin}){
$smb = Authen::Smb::authen($userData->{smbLogin}, $password, $userData->{smbPDC}, $userData->{smbBDC}, $userData->{smbDomain});
$error = "<li>".$smbError{$smb} if($smb > 0)
}else{
$error .= "<li>".WebGUI::International::get(5,'AuthSMB');
}
$self->user(WebGUI::User->new(1)) if $error ne "";
$self->error($error);
return $error eq "";
}
#-------------------------------------------------------------------
sub createAccount {
my $self = shift;
my $vars;
if ($session{user}{userId} != 1) {
return $self->displayAccount;
} elsif (!$session{setting}{anonymousRegistration}) {
return $self->displayLogin;
}
$vars->{'create.message'} = $_[0] if ($_[0]);
$vars->{'create.form.loginId'} = WebGUI::Form::text({"name"=>"authSMB.loginId","value"=>$session{form}{"authSMB.loginId"}});
$vars->{'create.form.loginId.label'} = WebGUI::International::get(8,'AuthSMB');
$vars->{'create.form.password'} = WebGUI::Form::password({"name"=>"authSMB.identifier","value"=>$session{form}{"authSMB.identifier"}});
$vars->{'create.form.password.label'} = WebGUI::International::get(9,'AuthSMB');
$vars->{'create.form.hidden'} = WebGUI::Form::hidden({"name"=>"confirm","value"=>$session{form}{confirm}});
return $self->SUPER::createAccount("createAccountSave",$vars);
}
#-------------------------------------------------------------------
sub createAccountSave {
my $self = shift;
my ($pdc, $bdc, $ntDomain, $smbLogin, $smb, $error,$username,$properties);
$pdc = $session{setting}{smbPDC};
$bdc = $session{setting}{smbBDC};
$ntDomain = $session{setting}{smbDomain};
$username = $session{form}{'authSMB.loginId'};
#Validate SMB Info
$smb = Authen::Smb::authen($username, $session{form}{'authSMB.smbPassword'}, $pdc, $bdc, $ntDomain);
if ($smb > 0) {
return $self->createAccount('<li>'. $smbError{$smb} . "pdc: $pdc, bdc: $bdc, domain: $ntDomain");
}
#Check that username is valid and not a duplicate in the system.
$error .= $self->error if($self->validUsername($username));
#Validate profile data.
my ($profile, $temp, $warning) = WebGUI::Operation::Profile::validateProfileData();
$error .= $temp;
return $self->createAccount("<h1>".WebGUI::International::get(70)."</h1>".$error) unless ($error eq "");
#If Email address is not unique, a warning is displayed
if($warning ne "" && !$session{form}{confirm}){
$session{form}{confirm} = 1;
return $self->createAccount('<li>'.WebGUI::International::get(1078));
}
$properties->{smbPDC} = $session{setting}{smbPDC};
$properties->{smbBDC} = $session{setting}{smbBDC};
$properties->{smbDomain} = $session{setting}{smbDomain};
$properties->{smbLogin} = $username;
return $self->SUPER::createAccountSave($username,$properties,$session{form}{'authSMB.smbPassword'},$profile);
}
#-------------------------------------------------------------------
sub deactivateAccount {
my $self = shift;
return $self->displayLogin if($self->userId eq '1');
return $self->SUPER::deactivateAccount("deactivateAccountConfirm");
}
#-------------------------------------------------------------------
sub deactivateAccountConfirm {
my $self = shift;
return $self->displayLogin unless ($session{setting}{selfDeactivation});
return $self->SUPER::deactivateAccountConfirm;
}
#-------------------------------------------------------------------
sub displayAccount {
my $self = shift;
my $vars;
return $self->displayLogin($_[0]) if ($self->userId eq '1');
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(61).'</h1>';
$vars->{'account.message'} = WebGUI::International::get(856);
if($session{setting}{useKarma}){
$vars->{'account.form.karma'} = $session{user}{karma};
$vars->{'account.form.karma.label'} = WebGUI::International::get(537);
}
$vars->{'account.options'} = WebGUI::Operation::Shared::accountOptions();
return WebGUI::Asset::Template->new($self->getAccountTemplateId)->process($vars);
}
#-------------------------------------------------------------------
sub displayLogin {
my $self = shift;
my $vars;
return $self->displayAccount($_[0]) if ($self->userId != 1);
$vars->{'login.message'} = $_[0] if ($_[0]);
return $self->SUPER::displayLogin("login",$vars);
}
#-------------------------------------------------------------------
=head2 editUserForm ( )
Creates user form elements specific to this Auth Method.
=cut
sub editUserForm {
my $self = shift;
return $self->addUserForm;
}
#-------------------------------------------------------------------
=head2 editUserFormSave ( )
Saves user elements unique to this authentication method
=cut
sub editUserFormSave {
my $self = shift;
return $self->addUserFormSave;
}
#-------------------------------------------------------------------
=head2 editUserSettingsForm ( )
Creates form elements for user settings page custom to this auth module
=cut
sub editUserSettingsForm {
my $self = shift;
my $f = WebGUI::HTMLForm->new;
$f->text("smbPDC",WebGUI::International::get(5,'AuthSMB'),$session{setting}{smbPDC});
$f->text("smbBDC",WebGUI::International::get(6,'AuthSMB'),$session{setting}{smbBDC});
$f->text("smbDomain",WebGUI::International::get(7,'AuthSMB'),$session{setting}{smbDomain});
$f->yesNo(
-name=>"smbSendWelcomeMessage",
-value=>$session{setting}{smbSendWelcomeMessage},
-label=>WebGUI::International::get(868)
);
$f->textarea(
-name=>"smbWelcomeMessage",
-value=>$session{setting}{smbWelcomeMessage},
-label=>WebGUI::International::get(869)
);
return $f->printRowsOnly;
}
#-------------------------------------------------------------------
sub getAccountTemplateId {
return "PBtmpl0000000000000007";
}
#-------------------------------------------------------------------
sub getCreateAccountTemplateId {
return "PBtmpl0000000000000008";
}
#-------------------------------------------------------------------
sub getLoginTemplateId {
return "PBtmpl0000000000000009";
}
#-------------------------------------------------------------------
sub login {
my $self = shift;
if(!$self->authenticate($session{form}{username},$session{form}{identifier})){
WebGUI::ErrorHandler::security("login to account ".$session{form}{username}." with invalid information.");
return $self->displayLogin("<h1>".WebGUI::International::get(70)."</h1>".$self->error);
}
return $self->SUPER::login(); #Standard login routine for login
}
#-------------------------------------------------------------------
sub new {
my $class = shift;
my $authMethod = $_[0];
my $userId = $_[1];
my @callable = ('createAccount','deactivateAccount','displayAccount','displayLogin','login','logout','createAccountSave','deactivateAccountConfirm');
my $self = WebGUI::Auth->new($authMethod,$userId,\@callable);
bless $self, $class;
}
1;

View file

@ -358,9 +358,8 @@ If specified, expireOffset is set to this value.
=cut
sub expireOffset {
my ($class, $value);
$class = shift;
$value = shift;
my $class = shift;
my $value = shift;
if (defined $value) {
$class->{_group}{"expireOffset"} = $value;
WebGUI::SQL->write("update groups set expireOffset=".quote($value).",
@ -383,6 +382,7 @@ The name of the group you wish to instanciate.
=cut
sub find {
my $class = shift;
my $name = shift;
my ($groupId) = WebGUI::SQL->quickArray("select groupId from groups where groupName=".quote($name));
return WebGUI::Group->new($groupId);

View file

@ -246,13 +246,6 @@ if (eval { require Image::Magick }) {
print "Not installed. Thumbnailing will be disabled.\n";
}
print "Authen::Smb module (optional) ............ ";
if (eval { require Authen::Smb }) {
print "OK\n";
} else {
print "Not installed. You cannot use SMB authentication.\n";
}
# this is here to insure they installed correctly.
if ($prereq) {