[Catalyst] Catalyst + Authentication::CDBI

Ycrux ycrux at club-internet.fr
Tue Feb 28 22:06:12 CET 2006


Hi Matt!
I tried Catalyst::Plugin::Authentication::Store::DBIC, but now
I got a new error : Couldn't load "GDLWeb2::Model::CustomerRole"

What is the problem?

This is my DB schema and MVC modules (see below):

CREATE TABLE customer (
        id       SERIAL                 NOT NULL,
        username CHARACTER VARYING(100) NOT NULL,
        surname  CHARACTER VARYING(100) NOT NULL,
        email    CHARACTER VARYING(100) NOT NULL,
        password CHARACTER VARYING(100) NOT NULL,

        PRIMARY KEY(id),
        UNIQUE (email)
    );

    CREATE TABLE role (
        id   SERIAL                 NOT NULL,
        name CHARACTER VARYING(30),

        PRIMARY KEY(id),
        UNIQUE (name)
    );

    CREATE TABLE customer_role (
        customer INTEGER NOT NULL,
        role     INTEGER NOT NULL,

        PRIMARY KEY(customer, role)
    );


package GDLWeb2::Model::Customer;

use strict;
use warnings;
use base 'Catalyst::Model::DBIC';

__PACKAGE__->config(
    dsn           => 'dbi:Pg:dbname=test',
    user          => 'postgres',
    password      => '',
    options       => { RaiseError => 1, AutoCommit => 1 },
    relationships => 1
);


__PACKAGE__->table( 'customer' );
__PACKAGE__->add_columns( qw/id username surname email password/ );
__PACKAGE__->set_primary_key( 'id' );

__PACKAGE__->has_many(
                map_user_role => 'MyApp::Model::CustomerRole' => 'customer',
                      );

package GDLWeb2::Model::Role;

use strict;
use warnings;
use base 'Catalyst::Model::DBIC';

__PACKAGE__->config(
    dsn           => 'dbi:Pg:dbname=test',
    user          => 'postgres',
    password      => '',
    options       => { RaiseError => 1, AutoCommit => 1 },
    relationships => 1
);


__PACKAGE__->table( 'role' );
__PACKAGE__->add_columns( qw/id name/ );   
__PACKAGE__->set_primary_key( 'id' );

__PACKAGE__->has_many(
                map_user_role => 'MyApp::Model::CustomerRole' => 'role',
                      );

package GDLWeb2::Model::CustomerRole;

use strict;
use warnings;
use base 'Catalyst::Model::DBIC';

__PACKAGE__->config(
    dsn           => 'dbi:Pg:dbname=test',
    user          => 'postgres',
    password      => '',
    options       => { RaiseError => 1, AutoCommit => 1 },
    relationships => 1
);


__PACKAGE__->table( 'customer_role' );
__PACKAGE__->add_columns( qw/customer role/ 
);                                
__PACKAGE__->set_primary_key( qw/customer role/ );




Matt S Trout a écrit :
> On Tue, Feb 28, 2006 at 07:53:47PM +0100, Ycrux wrote:
>   
>> Hi All!
>>
>> I want to setup a user authentication based on Authentication::CDBI
>>     
>
> Deprecated. Use Catalyst::Plugin::Authentication and
> Catalyst::Plugin::Authentication::Store::DBIC (which also supports Class::DBI
> although it can't query the database as efficiently as DBIx::Class can if
> you're using it for role-based authorization as well due to Class::DBI not
> knowing what a join is).
>
>   




More information about the Catalyst mailing list