[Catalyst] $c->user->name is $c->user->id
Yuval Kogman
nothingmuch at woobling.org
Sat Dec 31 20:25:48 CET 2005
On Sat, Dec 31, 2005 at 18:49:25 +0200, raptor wrote:
>
> |On Sat, Dec 31, 2005 at 01:35:56 +0200, raptor wrote:
> |> hi,
> |>
> |> it seems that $c->user->name is accessed as $c->user->id instead.(Authentication)
> |> is it ?
> |
> |Please say what Authentication::Store plugin you're using, and how
> |it's set up - $c->user could be anything =)
>
> ]- Authentication Authentication::Store::Minimal Authentication::Credential::Password
> Isnt it supposed $c->user to be username ? or at least the structrure to
> be exact no matter what the Store is ?
$c->user is an object, that depends on the store, but adheres to a
common API (hopefully ;-).
Several things this API does:
$c->user->id is supposed to return something unique
$c->user->store is supposed to return the store it came from
When you use the Minimal store you give it a few hash references,
and it makes them into objects and fills store in.
This means that the data you gave it will be the data you get back
from it.
$c->user->id is the key you gave:
{
foo => {
password => "secret",
}
}
will create a user object like this:
Catalyst::Plugin::Authentication::User::Hash->new(
id => "foo",
password => "secret",
store => $minimal_store_object,
);
So, if you want 'name' to be filled in, just add a name field, or
use a more comprehensive store. Minimal was created for quick and
dirty prototyping, or testing, or tiny applications.
--
() Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418 perl hacker &
/\ kung foo master: /me does a karate-chop-flip: neeyah!!!!!!!!!!!!!!
More information about the Catalyst
mailing list