[Catalyst] Catalyst::Plugin::Authentication::Store::DBICSchema

Alex Kavanagh alex at tinwood.homelinux.org
Fri Feb 10 23:14:34 CET 2006


Hi

I've been playing with Brandon's Catalyst::Model::DBIC::Schema and I
found that the DBIC authentication plugin didn't work because it
wanted to get at classes to do the searches and I couldn't get them to
work at all.

Thus I copied C::P::A::Store::DBIC (and sub modules) and I have
created ::DBICSchema (and submodules ::DBICSchema::Backend and
::DBICSchema::User)

However, this being my first time trying to add to the Catalyst code,
I'm not at all sure that I've done them properly.  I've attached the
three modules at the end (hope that is okay for the list).

They are rough and ready and have not had the documentation updated
yet.

The changes allow Backend and User to call model on the context object
to get at the resultset so that search can work.

The config is set as:

__PACKAGE__->config->{authentication}->{dbic} = {
#               user_class         => 'AJKSite::Model::SiteDBIC::Users',
	       user_model         => 'SiteDB::Users',
               user_field         => 'username',
               password_field     => 'password',
               password_type      => 'clear',  # will be 'hashed'
               password_hash_type => 'SHA-1',

NOTE the change to 'user_model' from 'user_class'

Authorization is configured as:

__PACKAGE__->config->{authorization}->{dbic} = {
#               role_class           => 'AJKSite::Model::SiteDBIC::Roles',
	       role_model           => 'SiteDB::Roles',
               role_field           => 'role',
               role_rel             => 'map_user_role',            # DBIx::Class only
               user_role_user_field => 'username',
           };

again, NOTE, 'role_model' instead of 'role_class'.

Please could someone who understands the innards of Catalyst and
Authentication check over the modules and make sure they make sense.

1. Is it okay to cache the context ($c) in the Backend class for the use of
   finding the model and thus resultset?
2. Should it be named ::DBIC::Schema instead of DBICSchema?

Many thanks for your help:

Cheers
-- 
Alex.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: DBICSchema.pm
Type: application/octet-stream
Size: 9332 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060210/af238c44/DBICSchema.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Backend.pm
Type: application/octet-stream
Size: 1606 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060210/af238c44/Backend.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: User.pm
Type: application/octet-stream
Size: 3378 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060210/af238c44/User.obj


More information about the Catalyst mailing list