Fetching contributors…
Cannot retrieve contributors at this time
29 lines (23 sloc) 547 Bytes
class ApplicationController < ActionController::Base
protect_from_forgery
def login_required
if current_user.blank?
respond_to do |format|
format.html {
authenticate_user!
}
format.js{
render :partial => "common/not_logined"
}
format.all {
head(:unauthorized)
}
end
end
end
def require_is_admin
unless (current_user && current_user.admin?)
redirect_to root_path, :flash => { :error => "no permission" }
end
end
end