permit "superadmin or administrator of "

15 views
Skip to first unread message

Erwin

unread,
Jul 3, 2009, 6:23:28 PM7/3/09
to Rails Authorization Plugin
I have a Controller with a before_filter to find the parent

LibrariesController
before_filter :find_academy



..
private
# Find academy params[:academy_id]
def find_academy
@academy = Academy.find(params[:academy_id]) unless params
[:academy_id].nil?
rescue ActiveRecord::RecordNotFound
render_404
end

I would like to authorize ONLY the superadmin and the administrator of
the academy to perform actions
I can write in EACH action

permit "superadmin or administrator of :academy" do
..
end

but is there a way to write it only once ? in a before_filter ?

thanks for your enlightments

erwin
Reply all
Reply to author
Forward
0 new messages