[Catalyst] Role problem

Ivan Wills ivanw at benon.com
Mon Feb 26 02:32:14 GMT 2007


Hi,

I'm trying to use Roles with DBIC user storage. When I try to use
$c->assert_user_roles('Admin'); I get the following error message:

|Caught exception in App::JumboRewards::Controller::MyAccount->test "DBIx::=
Class::ResultSet::all(): Error executing 'SELECT me.role FROM role me LEFT =
JOIN member_role map_member_role ON ( map_member_role.role_id =3D me.role_i=
d ) WHERE ( map_member_role.member_alias =3D ? AND me.role IN ( ? ) )': ERR=
OR:  column map_member_role.member_alias does not exist"

|

It looks like to me something is not joining to the member table when it
should but I am not sure where to look. My setup is fairly similar to
the example given at the end of
Catalyst::Plugin::Authentication::Store::DBIC, with table and column
names changed to match my companies coding standards.

Any suggestions on what I have done wrong?

Thanks
Ivan Wills

PS my Schema files look like:

||||

package App::JumboRewards::Schema::MemberRole;
use strict;
use base 'DBIx::Class';

__PACKAGE__->load_components( qw/ Core / );
__PACKAGE__->table( 'member_role' );
__PACKAGE__->add_columns( qw/member_role_id member_role_created
member_id role_id/ );
__PACKAGE__->set_primary_key( qw/member_id role_id/ );

__PACKAGE__->belongs_to( member_id =3D> 'App::JumboRewards::Schema::Member'=
 );
__PACKAGE__->belongs_to( role_id   =3D> 'App::JumboRewards::Schema::Role'  =
 );
1;
package App::JumboRewards::Schema::Role;
use strict;
use base 'DBIx::Class';

__PACKAGE__->load_components( qw/ Core / );
__PACKAGE__->table( 'role' );
__PACKAGE__->add_columns( qw/role_id role_created role/ );
__PACKAGE__->set_primary_key( 'role_id' );

__PACKAGE__->has_many(
    map_member_role =3D> 'App::JumboRewards::Schema::MemberRole' =3D> 'role=
_id'
);

1;
package App::JumboRewards::Schema::Member;
use strict;
use base 'DBIx::Class';

__PACKAGE__->load_components( qw/ Core / );
__PACKAGE__->table( 'member' );
__PACKAGE__->add_columns( qw/member_id member_created member_alias
member_password member_email member_ip/ );
__PACKAGE__->set_primary_key( 'member_id' );

__PACKAGE__->has_many(
    map_member_role =3D> 'App::JumboRewards::Schema::MemberRole' =3D>
'member_id',
);

1;


My App::JumboRewards.pm has the following Authentication setup

__PACKAGE__->config(
    authorization =3D> {
        dbic =3D> {
            role_class           =3D> 'DB::Role',
            role_field           =3D> 'role',
            role_rel             =3D> 'map_member_role',
            user_role_user_field =3D> 'member_alias',
        },
    },
    authentication =3D> {
        dbic =3D> {
            user_class           =3D> 'DB::Member',
            user_field           =3D> 'member_alias',
            password_field       =3D> 'member_password',
        },
    },
    ...
);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070226/14e70=
615/attachment.htm


More information about the Catalyst mailing list