]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Add cancancan and the first ability definitions for site_controller
[rails.git] / app / controllers / application_controller.rb
index db4ae9ad392f20f91a60d6c251f8244633cc7d34..394b04d58d5a52b8656bca5db03e49384f425b2a 100644 (file)
@@ -1,5 +1,6 @@
 class ApplicationController < ActionController::Base
   include SessionPersistence
+  check_authorization
 
   protect_from_forgery :with => :exception
 
@@ -467,6 +468,11 @@ class ApplicationController < ActionController::Base
     raise
   end
 
+  rescue_from CanCan::AccessDenied do |exception|
+    raise "Access denied on #{exception.action} #{exception.subject.inspect}"
+    # ...
+  end
+
   private
 
   # extract authorisation credentials from headers, returns user = nil if none