[Catalyst] C::P::A::Store::DBIC and Schema support

Alex Kavanagh alex at tinwood.homelinux.org
Sun Feb 19 13:56:45 CET 2006


Hi

My dislocated shoulder has finally healed enough to type again ...

Anyway, I checked the trunk for
Catalyst::Plugin::Authentication::Store::DBIC with DBIx::Class::Schema
support because I had been working on something similar before my
accident.  I found that there was some changes in trunk with
'dbic_schema' config.

The relevant lines in C::P::A::S::D::User are:

    my $user_class = $config->{auth}->{dbic_schema}
        ? $config->{auth}->{dbic_schema}->resultset( $config->{auth}->{user_class} )
        : $config->{auth}->{user_class};
    my $user_obj = $user_class->search( { $config->{auth}->{user_field} => $id } )->first;

For this to work, the $config->{auth}->{dbic_schema} needs to be a
DBIx::Class object connected to a database.

The thing is:

How do I set this up?

Before I delved too deeply, I tried my set up as:

__PACKAGE__->config->{authentication}->{dbic} = {
	       dbic_schema        => 'SiteDBIxSchema::Schema',
	       user_class         => 'Users',
               user_field         => 'username',
               password_field     => 'password',
               password_type      => 'clear',  # will be 'hashed'
               password_hash_type => 'SHA-1',
           };

where SiteDBIxSchema::Schema is the schema for the database
(e.g. SiteDBIxSchema::Schema-connect(...) gives an object that
resultset works on. and 'Users' is the Users table.

However, (obviously) this doesn't work.

Anybody know how to configure this module to work with
DBIx::Class::Schema ??

My version of the schema support involved caching the '$c' when the
'User.pm' object was created in C::P...::DBIC.pm and this allowed me
to use var->model( <config_model> ) where <config_model> was
'SiteDB::Users' and SiteDB was the namespace for the Schema.

I can't quite work out where to get the Schema object from to get it
into the config so that the Plugin will actually work.

Thanks
Alex.
-- 
Alex Kavanagh

Sorry for the lower case and mistakes - I am recovering from a
dislocated right shoulder, typing with my left hand only and I'm
right-handed!



More information about the Catalyst mailing list