[Catalyst] Role problem

Ivan Wills ivanw at benon.com
Tue Feb 27 01:07:47 GMT 2007


Thanks for that Jason, got confused at the meaning of
user_role_user_field I thought it meant the user name filed but it must
actually mean the user id filed which is not obvious if you are using a
more verbose naming conventions where id columns are postfixed with _id.

Ivan


Jason Kohles wrote:
> On Feb 25, 2007, at 9:32 PM, Ivan Wills wrote:
>
>> 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?
>>
>
> Your configuration says the userid field in the mapping class is
> called 'member_alias', but your MemberRole class doesn't have a field
> with that name.  I suspect you wanted
> __PACKAGE__->config->{authorization}->{dbic}->{user_role_user_field} =
> 'memeber_id';
>  
>> package App::JumboRewards::Schema::MemberRole;
>> __PACKAGE__->add_columns( qw/member_role_id member_role_created
>> member_id role_id/ );
>>
>> __PACKAGE__->config(
>>     authorization => {
>>         dbic => {
>>             user_role_user_field => 'member_alias',
>>         },
>>     },
>> );
>
> -- 
> Jason Kohles
> email at jasonkohles.com <mailto:email at jasonkohles.com>
> http://www.jasonkohles.com/
> "A witty saying proves nothing."  -- Voltaire
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>   




More information about the Catalyst mailing list