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: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to