[Catalyst] $c->user and session questions

Kenneth S Mclane ksmclane at us.ibm.com
Thu May 31 13:40:38 GMT 2012


I found that I can simply reference $c->user->hrfirstname. 

As to the role info, that comes from a different source (an sqlite db just 
for this info). I found that $c->session(role => $role); works to insert 
the value in the session, so I just need to pull the data from the table 
into the variable and then I'm good. Thanks for the suggestions.

Tomas Doran <bobtfish at bobtfish.net> wrote on 05/31/2012 08:31:31 AM:

> From:
> 
> Tomas Doran <bobtfish at bobtfish.net>
> 
> To:
> 
> The elegant MVC web framework <catalyst at lists.scsys.co.uk>
> 
> Date:
> 
> 05/31/2012 08:32 AM
> 
> Subject:
> 
> Re: [Catalyst] $c->user and session questions
> 
> 
> On 31 May 2012, at 14:00, Kenneth S Mclane wrote:
> 
> > I have an LDAP server authenticating my users. The look up returns
> a ton of fields in a hash. My questions are as follows: 
> > 
> > 1. What happens to this data/information? Is it stored in the 
> $c->user object? 
> 
> Yes
> 
> > 2. If it is, how do I access it? 
> 
> https://metacpan.org/module/Catalyst::Authentication::Store::LDAP::User
> 
> Like that. Specifically the ->ldap_entry method is probably what you're 
after.
> 
> > 3. Is there a simple way to look at what is stored in the user object? 

> 
> Data::Dumper::Dumper($c->user) ?
> 
> > 4. I would like to store the users role in the session object so 
> it can be accessed for authorization purposes. The docs only have an
> example of storing stuff in a shopping cart, which is a bit more 
> than I need, but there isn't enough there for me to figure out how 
> to store just one thing, and retrieve it, of course. Can someone 
> show me how to do this? 
> > 
> 
> You need to override the user class, and implement the for_session 
> and from_session methods to get additionally stuff serialized.
> 
> Cheers
> t0m
> 
> 
> _______________________________________________
> 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.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120531/3479b1a4/attachment.htm


More information about the Catalyst mailing list