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 syntax?