[Catalyst] Pulling My Hair Out with DBIx::Schema For Authentication and Authorization
Wade.Stuart at fallon.com
Wade.Stuart at fallon.com
Wed Mar 29 18:19:27 CEST 2006
catalyst-bounces at lists.rawmode.org wrote on 03/28/2006 08:54:53 PM:
> On 3/21/06, hkclark at gmail.com <hkclark at gmail.com> wrote:
> > Based on Matt's suggestion to my email yesterday
> > (http://www.gossamer-threads.com/lists/catalyst/users/5951), I have
> > been hard at work trying to convert from "Simple" DBIx::Class to the
> > "Schema" (DBIx::Class::Schema) approach. I must be missing something
> > because I can't get it to work. I have searched through the archives
> > and found other people talking about aspects of the problem I'm trying
> > to solve, but I haven't found a close or complete enough example to
> > put all the pieces together. If I can get this working, I would be
> > glad to post all of the code to the wiki as a self-contained example
> > for the benefit of others.
> >
>
> Hi Everyone,
>
> After beating my head against the wall for the past week, I finally
> figured out the deal with this. Turns out when
> Catalyst::Plugin::Authentication::Store tries to pull up the Model for
> my User class using:
> my $model = $c->model($user_class) || $c->comp($user_class);
> It descends into _comp_search() of Catalyst.pm where a regex is used
> to locate the component. Because I had both a User and a UserRole
> class, it found a match with UserRole when I really needed User. That
> caused things to blow sky high. (As an interesting aside, while
> $c->model($user_class) didn't work, the $c->comp($user_class) was
> fine.)
I was under the impression that this was fixed a long time ago in core to
take the more specific match? If I remember correctly there was a huge
thread on how it should search and what the outcome should be after the fix
was applied.
hmph
>
> Ways to get around this problem (other than hacking the code of
> Authentication::Store::DBIC to put the $c->comp() first):
> 1) Don't user "overlapping" names for your Model/Component classes
> (IOW, one class name shouldn't be a subset of another name).
> 2) In your config (myapp.yml in my case), define "user_class" and
> "role_class" as "DBIC::User" and "DBIC::Role" respectively (vs.
> "MyApp::Model::DBIC::User" and "MyApp::Model::DBIC::Role").
> 3) It sounds like a new approach to _comp_search() (or related code)
> has been applied to trunk in the Catalyst repository. So, you could
> wait for the next version of Cat or run from the development build.
More information about the Catalyst
mailing list