Merge branch 'master' into WebGUI8

This commit is contained in:
Graham Knop 2010-04-13 07:50:02 -05:00
commit 2400f19099
797 changed files with 33894 additions and 27196 deletions

View file

@ -49,8 +49,9 @@ These subroutines are available from this package:
=head2 bind ( )
Authenticates against the ldap server with the parameters stored in the class, returning a valid ldap connection, or 0 if a connection
cannot be established
Authenticates against the ldap server with the parameters stored in the
class, returning a valid ldap connection, or 0 if a connection cannot
be established
=cut
@ -106,9 +107,9 @@ sub connectToLDAP {
$self->{_uri} = $uri;
my $ldap = Net::LDAP->new($uri->host,
port => $uri->port, #Port will default to 389 or 636
scheme => $uri->scheme
scheme => $uri->scheme,
);
unless($ldap) {
$self->{_error} = 103;
return undef;
@ -141,6 +142,19 @@ sub get {
#-------------------------------------------------------------------
=head2 getErrorCode ( )
Returns the numerical error code generated by the bind() method.
=cut
sub getErrorCode {
my $self = shift;
return $self->{_error};
}
#-------------------------------------------------------------------
=head2 getErrorMessage ( [ldapErrorCode] )
Returns the error string representing the error code generated by Net::LDAP. If no code is passed in, the most recent error stored by the class is returned
@ -153,7 +167,7 @@ A valid ldap error code.
sub getErrorMessage {
my $self = shift;
my $errorCode = shift || $self->{_error};
my $errorCode = shift || $self->getErrorCode;
return "" unless $errorCode;
my $i18nCode = "LDAPLink_".$errorCode;
my $i18n = WebGUI::International->new($self->session,"AuthLDAP");
@ -217,9 +231,7 @@ Disconnect cleanly from the current databaseLink.
=cut
sub unbind {
my ($self, $value);
$self = shift;
$value = shift;
my $self = shift;
if (defined $self->{_connection}) {
$self->{_connection}->unbind;
}
@ -242,12 +254,11 @@ The ldapLinkId of the ldapLink you're creating an object reference for.
=cut
sub new {
my ($ldapLinkId, $ldapLink);
my $class = shift;
my $session = shift;
$ldapLinkId = shift;
my $class = shift;
my $session = shift;
my $ldapLinkId = shift;
return undef unless $ldapLinkId;
$ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]);
my $ldapLink = $session->db->quickHashRef("select * from ldapLink where ldapLinkId=?",[$ldapLinkId]);
bless {_session=>$session, _ldapLinkId=>$ldapLinkId, _ldapLink=>$ldapLink }, $class;
}