[Catalyst] backward compatibility problem with new C::P::Authentication (for info only)

Jay K jayk at ion0.com
Fri Dec 14 18:17:28 GMT 2007


Hi There,

Yes.  get_user is a compatibility call and only really works properly
when in compatibility mode - IE along with $c->login and placing all
the modules in the use Catalyst section.

The chances are the reason it doesn't work is that it is the old call
based on whatever the argument is being the 'id' in the record.  This
doesn't make a whole lot of sense in the new configuration.

$c->user or $c->user->obj is the correct way to get the currently
authenticated user (this has not changed from the old api)

Jay


On Dec 13, 2007, at 2:53 PM, Daniel McBrearty wrote:

> everything seems to be running fine now after a few code updates. I
> came across one oddity though that might be of interest.
>
> In my old code, I had this construct in a few places, to get the user
> object from the database:
>
> my $user = $c->get_user( $username );
>
> It seems that the get_user method was working, but somehow returning
> entirely the wrong user object from the database. This was probably a
> really crappy way of doing things, and using
>
> $c->user
>
> instead fixes everything. Even so, it looks like buggy behaviour -
> maybe get_user needs to be removed or be fixed or something (I
> couldn't even find docs for it in new code, so I am not sure which
> module is actually implementing it now).
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

---
For most things, throwing yourself at the wall over and over is a
better way to improve than thinking hard about the wall and taking
pictures of it.  -- D.Litwack





More information about the Catalyst mailing list