if_attribute sintax problem on declarative_authorization
Posted
by Victor Martins
on Stack Overflow
See other posts from Stack Overflow
or by Victor Martins
Published on 2010-03-30T17:48:20Z
Indexed on
2010/03/30
17:53 UTC
Read the original article
Hit count: 580
ruby-on-rails
|declarative-authorization
I have an Organization that has_many Affiliations And a mission that has_one Organization
So i can do this:
m = Mission.first
m.organization.affiliations
A user also has_many affiliations so I can do:
u = User.first
u.affiliations
In declarative_authorization I want a user to be able to manage a mission if he is affiliated to the organization of the mission.
I'm trying this:
has_permission_on :missions, :to => [:manage] do
if_attribute [:affiliations, {:mission => :organization} ] => intersects_with {
user.affiliations.type_admin
}
end
But I get the error:
[:affiliations, {:mission=>:organization}] is not a symbol
What's wrong with the sintax?
© Stack Overflow or respective owner