[Catalyst] check_user_roles [ $user ], @roles ?

Jens Schwarz blacky6767 at gmx.de
Wed Feb 4 13:03:22 GMT 2009


Hi *,

in my Catalyst app I use $c->check_user_roles(qw/Admin/) to determine, if the currently logged in user is part of the Admin role. Works fine.

Now I want to check if _another_ (currently _not_ logged in user) is part of the Admin role. I read the documentation of Catalyst::Plugin::Authorization::Roles and found that check_user_roles can optionally take $user as additional parameter. But it does not work as I suspected: With ...

$c->log->info(">> " . $c->check_user_roles( "some_other_user" , qw/Admin/ ));

... Catalyst debug just gives me ...

[debug] Role denied: some_other_user, Admin
[info] >>

... where I expected something like ...

[info] >> 1

"some_other_user" is a username string, in the column "username" of my user table. myapp/myapp.conf ist setup accordingly (i.e.: user_class myapp::user and id_field username).

What am I doing wrong?

Jens
-- 
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL 
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a



More information about the Catalyst mailing list