From 3895defa454ae29233a9d11d2cb0bece9c89fd57 Mon Sep 17 00:00:00 2001 From: "Timothy N. Tsvetkov" Date: Mon, 11 Apr 2011 17:04:03 +0400 Subject: [PATCH] defferent ip auth for build service and product builder --- app/controllers/application_controller.rb | 10 ++++++++-- app/controllers/build_lists_controller.rb | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9d4dd539b..51b260773 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,8 +11,14 @@ class ApplicationController < ActionController::Base end end - def authenticate_by_ip! - if request.remote_ip != APP_CONFIG['auth_by_ip'] + def authenticate_build_service! + if request.remote_ip != APP_CONFIG['build_service_ip'] + render :nothing => true, :status => 403 + end + end + + def authenticate_product_builder! + if request.remote_ip != APP_CONFIG['product_builder_ip'] render :nothing => true, :status => 403 end end diff --git a/app/controllers/build_lists_controller.rb b/app/controllers/build_lists_controller.rb index 72163dc7c..de415f9c8 100644 --- a/app/controllers/build_lists_controller.rb +++ b/app/controllers/build_lists_controller.rb @@ -1,6 +1,6 @@ class BuildListsController < ApplicationController before_filter :authenticate_user!, :except => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt] - before_filter :authenticate_by_ip!, :only => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt] + before_filter :authenticate_build_service!, :only => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt] before_filter :find_platform, :only => [:index, :filter, :show] before_filter :find_repository, :only => [:index, :filter, :show] before_filter :find_project, :only => [:index, :filter, :show]