[Catalyst] action_for with user_id removed ...
kiffin.gish at planet.nl
Mon Feb 1 20:37:23 GMT 2010
Then to make my story complete, I just snip out the part of the action
chain that extracts the id, and hook up the loose ends. Very elegant!
On Mon, 2010-02-01 at 20:38 +0200, Octavian Rasnita wrote:
> From: "Kiffin Gish" <kiffin.gish at planet.nl>
> >I have a number of user-defined actions which are described with the
> > user id like this:
> > settings/user_id/(view|edit)
> > Where user_id is the primary key into the users resultset. However, I do
> > not want this to be visible to the end-user for security reasons (if I'm
> > admin it's alright).
> > Is it possible to retain these, but for users who are logged in
> > the /user_id/ is removed to get this visible instead:
> > settings/(view|edit)
> > Thanks alot in advance.
> > --
> > Kiffin Gish <kiffin.gish at planet.nl>
> > Gouda, The Netherlands
> If your users have an ID, they're probably logged in. If they are logged in,
> you can get and use that ID in your app by getting it with:
> my $user_id = $c->user->obj->id
> my $user_id = $c->user->get('id');
> (And the second way is recommended).
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://email@example.com/
> Dev site: http://dev.catalyst.perl.org/
Kiffin Gish <Kiffin.Gish at planet.nl>
Gouda, The Netherlands
More information about the Catalyst