how to monitor if the roles for a user change ?

12 views
Skip to first unread message

jaambros

unread,
Nov 3, 2011, 4:38:13 PM11/3/11
to acl9-discuss
I need to monitor when the roles for a user change (say a role is
added or deleted).
The natural thing that occurs to me is to place callbacks (eg,
before_save) in the join table (say roles_users if the subjects are
users).
However, acl9 uses HABTM associations so there is no model associated
with the join table.
Any ideas on how I can do this?
After searching here and there I found there was an effort to modify
acl9 to use has_many :through associations. Does anybody know if this
is working and where to find it?

Any help here would be greatly appreciated. THanks, Jose

Sharad Jain

unread,
Nov 3, 2011, 10:46:18 PM11/3/11
to acl9-d...@googlegroups.com
One way would be to override User.has_role! and User.has_no_role! methods...

--

Sharad Jain,
Tel: 312.208.0211, Email: shaa...@gmail.com
Mortgage Brokerage, Nail Your Mortgage
Realtor, Charles Rutenberg Realty

jaambros

unread,
Nov 8, 2011, 3:22:50 PM11/8/11
to acl9-discuss
Sharad,
Thanks for the idea. I had already begun work on those lines, and it
seems to be workable.

On Nov 3, 7:46 pm, Sharad Jain <shaanj...@gmail.com> wrote:
> One way would be to override User.has_role! and User.has_no_role! methods...
>
> --
>
> *Sharad Jain*,
> Tel: 312.208.0211, Email: shaanj...@gmail.com
> <mailto:sharad.j...@nailyourmortgage.com>
> Mortgage Brokerage, Nail Your Mortgage <http://www.nailyourmortgage.com/>
> Realtor, Charles Rutenberg Realty <http://www.charlesrutenbergre.com/>
Reply all
Reply to author
Forward
0 new messages