Remove a single role?

3 views
Skip to first unread message

wcheng

unread,
Aug 24, 2009, 10:06:58 PM8/24/09
to Rails Authorization Plugin
Hey everyone, does anyone know the method that removes a single role
from a user? Say I have a user.is_friend_of @targetuser. How would I
remove the role 'friend' from the current user with the corresponding
@targetuser.

Gokul Janga

unread,
Sep 27, 2009, 2:54:42 AM9/27/09
to Rails Authorization Plugin

When you add acts_as_authorized_user, you also get the following
method

has_no_role(role_name,authorizable_ob)
[ so you can say @user.has_no_role('friend',@targetuser) ]

see the code in object_roles_table.rb in the plugin.

Gj.
Reply all
Reply to author
Forward
0 new messages