issue allowing based on relation to model

1 view
Skip to first unread message

Kevin Compton

unread,
Oct 28, 2009, 5:23:58 PM10/28/09
to acl9-discuss
Users assigned role Corporate are supposed to be able to access their
own company show. Its getting blocked.

Admin can access fine, so can user role Corporate as long as the
condition of the company doesn't exist. So the issue is most likely to
do with the association between a corporate user and its company not
being recognized.


this doesn't work: allow :corporate, :of => :company

here is how I'm assigning it in the User controller:

if @user.role == "Corporate"
@user.has_role!(:corporate, @company)
end


You can see all the code here: http://pastie.org/672733

oleg dashevskii

unread,
Oct 29, 2009, 3:39:19 PM10/29/09
to acl9-d...@googlegroups.com
Hi Kevin,

create method in user controller seems to miss the creation code, i.e.
@user = User.new(params[:user])

It also seems not to load @company before User.has_role!(:corporate, @company).

2009/10/29 Kevin Compton <ktco...@gmail.com>



--
Олег.

Kevin Tyler Zepeda-Compton

unread,
Oct 29, 2009, 3:42:11 PM10/29/09
to acl9-d...@googlegroups.com
its in the Private
--
Kevin Compton
www.nufish.com
www.lastamericanbuffalo.com
626-488-6619


oleg dashevskii

unread,
Oct 29, 2009, 3:45:48 PM10/29/09
to acl9-d...@googlegroups.com
Please check that the role really gets assigned. You may check it from within the script/console. Try

>> User.find(333).has_role?(:corporate, Company.find(666))

should return true (replace 333 and 666 with proper ids)

2009/10/30 Kevin Tyler Zepeda-Compton <ktco...@gmail.com>



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