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 = me.role_id
) WHERE ( map_member_role.member_alias = ? AND me.role IN ( ? ) )': ERROR:
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 => 'App::JumboRewards::Schema::Member' );
__PACKAGE__->belongs_to( role_id => '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 => 'App::JumboRewards::Schema::MemberRole' => '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 => 'App::JumboRewards::Schema::MemberRole' =>
'member_id',
);
1;
My App::JumboRewards.pm has the following Authentication setup
__PACKAGE__->config(
authorization => {
dbic => {
role_class => 'DB::Role',
role_field => 'role',
role_rel => 'map_member_role',
user_role_user_field => 'member_alias',
},
},
authentication => {
dbic => {
user_class => 'DB::Member',
user_field => 'member_alias',
password_field => 'member_password',
},
},
...
);
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/