[Catalyst] switching Authentication::Store::DBIC?

Josef Chladek josef.chladek at boerse-express.com
Sun May 6 16:13:46 GMT 2007


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



More information about the Catalyst mailing list