> > 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? > > $c->check_user_roles expects a user object not a username string (how > would it distinguish a user name from a role name?). You can get a > user object via $c->find_user.
You mean something like ... my $foo = $c->find_user({ username => "some_other_user" }, "my_realm"); $c->log->info(">> " . $c->check_user_roles($foo, qw/Admin/)); ? This gives me nearly the same output as before - i.e.: [debug] Role denied: Catalyst::Authentication::Store::DBIx::Class::User=HASH(0x9abd318), Admin [info] >> I guess I am misundestanding something. Any hints? -- Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a _______________________________________________ List: Catalyst@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/