defferent ip auth for build service and product builder

This commit is contained in:
Timothy N. Tsvetkov 2011-04-11 17:04:03 +04:00
parent 4da241672b
commit 3895defa45
2 changed files with 9 additions and 3 deletions

View File

@ -11,8 +11,14 @@ class ApplicationController < ActionController::Base
end end
end end
def authenticate_by_ip! def authenticate_build_service!
if request.remote_ip != APP_CONFIG['auth_by_ip'] 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 render :nothing => true, :status => 403
end end
end end

View File

@ -1,6 +1,6 @@
class BuildListsController < ApplicationController class BuildListsController < ApplicationController
before_filter :authenticate_user!, :except => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt] 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_platform, :only => [:index, :filter, :show]
before_filter :find_repository, :only => [:index, :filter, :show] before_filter :find_repository, :only => [:index, :filter, :show]
before_filter :find_project, :only => [:index, :filter, :show] before_filter :find_project, :only => [:index, :filter, :show]