X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAuthentication%2FStore%2FDBIx%2FClass%2FUser.pm;h=caf64af90833fcaa674e4ed4539b84da3e645a5e;hb=ced434ba97a8e51d6c901f823d82d7f2639e729d;hp=6487ae13476e61ab2ac959d64fb67284a426df6d;hpb=d1710b0f62361ef5f2d4d04c946524a953cda036;p=catagits%2FCatalyst-Authentication-Store-DBIx-Class.git diff --git a/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm b/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm index 6487ae1..caf64af 100644 --- a/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm +++ b/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm @@ -83,7 +83,11 @@ sub load { $searchargs->{$key} = $authinfo->{$key}; } } - $self->_user($self->resultset->search($searchargs)->first); + if (keys %{$searchargs}) { + $self->_user($self->resultset->search($searchargs)->first); + } else { + Catalyst::Exception->throw("User retrieval failed: no columns from " . $self->config->{'user_class'} . " were provided"); + } } if ($self->get_object) { @@ -118,7 +122,7 @@ sub roles { if (exists($self->config->{'role_column'})) { my $role_data = $self->get($self->config->{'role_column'}); if ($role_data) { - @roles = split /[ ,\|]+/, $self->get($self->config->{'role_column'}); + @roles = split /[\s,\|]+/, $self->get($self->config->{'role_column'}); } $self->_roles(\@roles); } elsif (exists($self->config->{'role_relation'})) { @@ -270,13 +274,11 @@ Returns an array of roles associated with this user, if roles are configured for =head2 for_session -Returns a serialized user for storage in the session. Currently, this is the value of the field -specified by the 'id_field' config variable. +Returns a serialized user for storage in the session. =head2 from_session -Revives a serialized user from storage in the session. Currently, this uses the serialized data as the -value of the 'id_field' config variable. +Revives a serialized user from storage in the session. =head2 get ( $fieldname )