]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Altered old_way stuff to be Railsy like old_node is now
[rails.git] / app / controllers / application_controller.rb
index 7ac9e6402bc64236d80aeac26f28e1a36554060e..7043d8206363d7f4978d3afa4a9d7f571e217ac6 100644 (file)
@@ -160,6 +160,18 @@ class ApplicationController < ActionController::Base
     end 
   end 
 
+  ##
+  # to be used as a before_filter *after* authorize. this checks that
+  # the user is a moderator and, if not, returns a forbidden error.
+  #
+  def authorize_moderator(errormessage="Access restricted to moderators") 
+    # check user is a moderator
+    unless @user.moderator?
+      render :text => errormessage, :status => :forbidden
+      return false
+    end 
+  end 
+
   def check_database_readable(need_api = false)
     if STATUS == :database_offline or (need_api and STATUS == :api_offline)
       redirect_to :controller => 'site', :action => 'offline'