[Catalyst] Can't locate Catalyst/Plugin/Authentication/Store/DBIC.pm

Michael Higgins linux at evolone.org
Tue Dec 18 05:03:52 GMT 2007


On Mon, 17 Dec 2007 20:09:23 -0800
Michael Higgins <linux at evolone.org> wrote:

> On Mon, 17 Dec 2007 20:47:20 -0700
> Jay K <jayk at ion0.com> wrote:
> 
> > Hi Michael,
> > 
> > Unfortunately the Tutorial is a bit out of date.
> > 
> > Please look at this:
> > 
> > http://search.cpan.org/~jayk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm
> > 
> > and this:
> > 
> > http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class.pm
> > 
> > and your issues should be cleared up.
> > 
> > Jay
> 
> Thanks, Jay!
> 
> Cheers,
> 

So, the question I'd left off with was, basically, what's up with     if ( $c->check_user_roles( 'editor' ) ) {
        # do editor stuff
    }

I have a feeling that, since my roles are in a separate table, like '1'
is user, '2' is admin -- again, from that out of date tutorial -- that
this isn't going to work as expected, somehow. 

from /Catalyst/Authentication/Store/DBIx/Class.pm

"If your role information is stored in the same table as the rest of
your user information"...

Mine is not. 

Then, it reads about role_field, "This is the name of the field in the
role table that contains the string identifying the role".

I think that string for me is, like '1', because that is the role_id.
But, it looks like this should retrieve the id then return the name of
the role for matching... right?

+---------+-----------+
| role_id | role_name |
+---------+-----------+
|       1 | user      | 
|       2 | admin     | 
|       3 | guest     | 
+---------+-----------+


Maybe I need a different accessor, IDK. What I do know is it 'just
worked' and that's why I used Catalyst. Now, I'm wholly out of my depth.

I've continued now for another hour or so. It sure does seem like this
isn't going to work. Do I need to change my data tables in order to use
this now?

    role_field => 'role_id',

... gives me:

SELECT me.user_id, me.username, me.password, me.email_address,
me.first_name, me.last_name, me.bill2 FROM users me WHERE ( user_id = ? ): '1'

Great, found the 'admin'.

SELECT me.role_id FROM user_roles me WHERE ( me.user_id = ? ): '1'
Caught exception in BanTrace::Controller::Shipments->list "Missing
roles: admin at   

 $c->log->debug($c->assert_user_roles('admin'));

[debug] Role granted: 2
[debug] 1
[debug] Role denied: admin

Whereas:

role_field => 'role_name',

Gives me nothing at all. Never tries to check if I've got a role.

ACL rules are in effect as well?? What do I need to do to back out of
the basic tutorial setup, and get this working again? I have to think
that this information would only be helpful to others, no? Or am I the
only one who based an application on the tutorial? '-)

Do I go about redefining my 'roles' as '1', '2', '3'?? Or do I have to
change my database configuration?

Or, am I barking up the wrong tree? 

Cheers,

-- 
 |\  /|        |   |          ~ ~  
 | \/ |        |---|          `|` ?
 |    |ichael  |   |iggins    \^ /
 michael.higgins[at]evolone[dot]org



More information about the Catalyst mailing list