## From divoxx
## For better authorization
class FooController < ApplicationController
def edit
redirect_to access_denied_path and return unless level = user.has_right(controller_name, action_name)
case level
when :all
@foos = Foo.find(:all)
when :own
@foos = user.foos
end
end
end