[Catalyst] switching Authentication::Store::DBIC?
Yuval Kogman
nothingmuch at woobling.org
Sun May 6 22:05:04 GMT 2007
Set up three instances of the store backend under different names,
and use the more "manual" variants of ->get_user, and pass a user
object to $c->login.
Another option is to try and create a consolidated view of the two
data sets, either using an SQL level view or a custom backend.
On Sun, May 06, 2007 at 17:13:46 +0200, Josef Chladek wrote:
> hello list,
>
> I am using C::P::Authentication with Store::DBIC as backend. from the docs I read that you can use different store backends, but what I want to achieve is, switching the dbic user_class (and role_class)
> during runtime
>
> in the Myapp.pm
>
> __PACKAGE__->config->{authentication}{dbic} = {
> user_class => 'Users::User',
> user_field => 'UID',
> password_field => 'password',
> password_type => 'crypted',
> password_hash_type => 'password_pre_salt',
> };
>
> __PACKAGE__->config->{authorization}{dbic} = {
> role_class => 'Users::Auth_Roles',
> role_field => 'name',
> role_rel => 'map_role_assignments', # DBIx::Class only
> user_role_user_field => 'user_id',
> };
>
> and then in some controller if $c->login fails, I would like to write
>
> $c->config->{authentication}{dbic} = {
> user_class => 'Users::OtherUser',
> user_field => 'UID',
> password_field => 'password',
> password_type => 'crypted',
> password_hash_type => 'password_pre_salt',
> };
> $c->config->{authorization}{dbic} = {
> role_class => 'Users::OtherAuth_Roles',
> role_field => 'name',
> role_rel => 'map_role_assignments', # DBIx::Class only
> user_role_user_field => 'user_id',
> };
>
> and try $c->login for users stored in Users::OtherUser.
>
> this is not recognized because setup registers this config at startup.
> is there a way to rerun setup (only for the Authentication part)? or is there another way of swapping user_classes during 'runtime' of the server?
>
> thanks
> josef
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
--
Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org 0xEBD27418
More information about the Catalyst
mailing list