[Catalyst] Authentication::Store::DBIC => Can't call method "search" in uthentication::Store::DBIC::User ???

Yuval Kogman nothingmuch at woobling.org
Sun Apr 23 13:30:48 CEST 2006

On Sun, Apr 23, 2006 at 03:06:37 +0200, T. H. Lin wrote:
> It seems
> __PACKAGE__->config->{authentication}{dbic} = {
>          user_class               => 'DBIC::User',
>          user_field                 => 'name',
>          password_field        => 'pass',
>          password_type         => 'hashed',
>          password_hash_type => 'SHA-256',
>      };
> must be defined in MyApp.pm(and before __PACKAGE__->setup !!)
> but....
> I have 2 tables for two different type of account,
> (for some reason, I make 2 tables, do not use role method)
> MyApp/C/basic_account.pm
> MyApp/C/advanced_account.pm
> I would like to define different user_class in basic_account.pm and
> advanced_account.pm.
>is it possible?

I agree with what John said, but there is support for this.

If you can't use role based access control
(Catalyst::Plugin::Authorization::Roles) then you can use the
non-easy interface into the authentication stores:

Initialize your own Catalyst::Plugin::Authentication::DBIC::Backend
(read the source code to see how this is done - each store may
require a different initialization sequence), register it, and then
create another, and register it by another name:

		basic => $backend,
		advanced => $backend,

Note that at this stage there is no store by the name of 'default' -
this means you have to use user objects. Instead of

	$c->login( "user", "password" ); # two string

You need to say

	my $user = $c->get_auth_store("basic")->get_user($username);
	$c->login( $user, $password );

and all the session integration will continue to work normally from
here, mapping to the right store.

You might want to put a multiplexing store in 'default', one that
will first try one store and then the other.

  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060423/cdae70c1/attachment.pgp 

More information about the Catalyst mailing list