Fix typos "it's" → "its"
[catagits/Catalyst-Authentication-Store-LDAP.git] / lib / Catalyst / Authentication / Store / LDAP / Backend.pm
index 59f0299..bd2276e 100644 (file)
@@ -74,11 +74,12 @@ use base qw( Class::Accessor::Fast );
 use strict;
 use warnings;
 
-our $VERSION = '1.015';
+our $VERSION = '1.016';
 
 use Catalyst::Authentication::Store::LDAP::User;
 use Net::LDAP;
 use Catalyst::Utils ();
+use Catalyst::Exception;
 
 BEGIN {
     __PACKAGE__->mk_accessors(
@@ -120,7 +121,8 @@ sub new {
     $config_hash{'role_filter'} ||= '(memberUid=%s)';
     $config_hash{'role_scope'}  ||= 'sub';
     $config_hash{'role_field'}  ||= 'cn';
-    $config_hash{'use_roles'}   ||= '1';
+    $config_hash{'use_roles'}   = '1'
+        unless exists $config_hash{use_roles};
     $config_hash{'start_tls'}   ||= '0';
     $config_hash{'entry_class'} ||= 'Catalyst::Model::LDAP::Entry';
     $config_hash{'user_class'}
@@ -278,7 +280,7 @@ Given a User ID, this method will:
   A) Bind to the directory using the configured binddn and bindpw
   B) Perform a search for the User Object in the directory, using
      user_basedn, user_filter, and user_scope.
-  C) Assuming we found the object, we will walk it's attributes
+  C) Assuming we found the object, we will walk its attributes
      using L<Net::LDAP::Entry>'s get_value method.  We store the
      results in a hashref. If we do not find the object, then
      undef is returned.
@@ -379,18 +381,18 @@ sub lookup_user {
 
 This method looks up the roles for a given user.  It takes a
 L<Catalyst::Authentication::Store::LDAP::User> object
-as it's first argument, and can optionally take a I<Net::LDAP> object which
+as its first argument, and can optionally take a I<Net::LDAP> object which
 is used rather than the default binding if supplied.
 
 It returns an array containing the role_field attribute from all the
-objects that match it's criteria.
+objects that match its criteria.
 
 =cut
 
 sub lookup_roles {
     my ( $self, $userobj, $ldap ) = @_;
     if ( $self->use_roles == 0 || $self->use_roles =~ /^false$/i ) {
-        return undef;
+        return ();
     }
     $ldap ||= $self->role_search_as_user
         ? $userobj->ldap_connection : $self->ldap_bind;
@@ -408,7 +410,7 @@ sub lookup_roles {
                 . $userobj->username
                 . " has no "
                 . $self->role_value
-                . " attribute, so I can't look up it's roles!" );
+                . " attribute, so I can't look up its roles!" );
     }
     my $filter = $self->_replace_filter( $self->role_filter, $filter_value );
     push( @searchopts, 'filter' => $filter );