diff options
author | Luke Shumaker <shumakl@purdue.edu> | 2014-04-29 11:25:23 -0400 |
---|---|---|
committer | Luke Shumaker <shumakl@purdue.edu> | 2014-04-29 11:25:23 -0400 |
commit | 0d6f7a3bfbf4c87510a1bcf967b618f98e149d49 (patch) | |
tree | e3cd7d5329bd3c04a2fbfc766db34766fab12bc3 /app/controllers/application_controller.rb | |
parent | 8aefe73872571ac54738bde71d4da5611659a0cc (diff) |
clean up permission system
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d5752aa..d416c94 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base include SimpleCaptcha::ControllerHelpers def check_permission(verb, object=nil) - unless current_user.can?((verb.to_s+"_"+noun).to_sym) or (!object.nil? and is_owner?(object)) + unless current_user.can?("#{verb.to_s}_#{noun}".to_sym) or object.try(:check_permission, current_user, verb) respond_to do |format| format.html do if object.nil? @@ -47,9 +47,4 @@ class ApplicationController < ActionController::Base object = send("set_"+noun) check_permission(:edit, object) end - - # Override this - def is_owner?(object) - return false - end end |