[Catalyst] getting the role id
Octavian Rasnita
orasnita at gmail.com
Sun Feb 4 17:59:49 GMT 2007
Ok, thank you. I will try it.
Octavian
----- Original Message ----- =
From: Jason Kohles =
On Feb 4, 2007, at 6:52 AM, Octavian Rasnita wrote:
Hi,
Is it possible to get the id of the roles of the current user from $c->=
user?
I found that I can get the role names using $c->user->roles, but I need=
the id of those roles.
Do I need to make another query to the database for finding this?
If you are using the normal many-to-many method for mapping roles, someth=
ing like this:
User->has_many( 'map_user_role', 'User::Role', 'user_id' );
User->many_to_many( 'roles', 'map_user_role', 'role' );
Then you can get the roles objects with $c->user->roles, and the User::Ro=
le objects with $c->user->map_user_role.
-- =
Jason Kohles
email at jasonkohles.com
http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
---------------------------------------------------------------------------=
---
_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.or=
g/
Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070204/2e857=
f53/attachment.htm
More information about the Catalyst
mailing list