2010-05-14 15:12:31 -07:00
|
|
|
class ApplicationController < ActionController::Base
|
|
|
|
protect_from_forgery
|
2011-06-27 12:33:34 -07:00
|
|
|
|
|
|
|
helper_method :can_use_image_mode?
|
|
|
|
|
2011-07-12 21:25:14 -07:00
|
|
|
def authenticate_user! # too lazy to change references to login_path
|
|
|
|
redirect_to(login_path) unless user_signed_in?
|
|
|
|
end
|
|
|
|
|
2011-06-27 12:33:34 -07:00
|
|
|
def can_use_image_mode?
|
|
|
|
user_signed_in? && current_user.image_mode_tester?
|
|
|
|
end
|
2011-07-15 13:15:57 -07:00
|
|
|
|
|
|
|
class AccessDenied < StandardError;end
|
|
|
|
|
|
|
|
rescue_from AccessDenied, :with => :on_access_denied
|
|
|
|
|
|
|
|
def on_access_denied
|
|
|
|
render :file => 'public/403.html', :layout => false, :status => :forbidden
|
|
|
|
end
|
2010-05-14 15:12:31 -07:00
|
|
|
end
|
2011-06-27 12:33:34 -07:00
|
|
|
|