Inherited role?

1 view
Skip to first unread message

Nik

unread,
Feb 3, 2010, 11:56:53 AM2/3/10
to acl9-discuss
Hi all,

Thanks for reading my post. - So I was finding it a bit cumbersome to
have to set 'owner' role to each of all line items of some project; is
there a way to set a user to be the 'owner' to some project so that
the user also becomes the 'owner' of the project's line items?

Thank You!

oleg dashevskii

unread,
Feb 3, 2010, 11:38:40 PM2/3/10
to acl9-d...@googlegroups.com
You can do this by overriding User#has_role?

class User
   # ...
   def has_role?(role, obj=nil)
      if obj.is_a? LineItem
         has_role?(role, obj.project)
      else
         super
      end
   end
end
   

2010/2/3 Nik <nik...@gmail.com>



--
Олег.
Reply all
Reply to author
Forward
0 new messages