[Catalyst] Where to put common functions & how to get user id

jakac jakac at iprom.si
Tue May 27 09:21:46 BST 2008


Andrew Rodland wrote:
> Create a model for the log (it could be a C::M::DBIC::Schema, your own custom 
> class, or something else) and then you can 
> $c->model('ActionLog')->logaction($userid, $action) assuming an appropriate 
> logaction method.
>
>   
Thanks for the hint! I will take a look at it...

> $c->user->get("user_id") etc. which is part of the universal authentication 
> interface. The DBIC store also provides $c->user->obj returns the underlying 
> object directly, but you probably don't need that. There are examples in 
> perldoc Catalyst::Plugin::Authentication.
>
>   

Doesn't work for me ...

$c->log->debug("username: -".$c->user->id."- users ID -" .
$c->user->get("user_id") ."-");

just produces output:
[debug] username: -user1- users ID --
(user's ID is blank)

I am using following plugins:

use Catalyst qw/-Debug ConfigLoader Static::Simple
                Session
                Session::DynamicExpiry
                Session::DynamicExpiry::Cookie
                Session::State::Cookie
                Session::Store::File
                Authentication
                Authentication::Store::DBIC
                Authentication::Credential::Password
                Authorization::Roles
                Authorization::ACL
                I18N
                Unicode
                /;





More information about the Catalyst mailing list