summaryrefslogtreecommitdiff
path: root/app/controllers/ci
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-09-18 10:19:08 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2015-09-18 12:46:47 +0200
commite41a29b0c381458f789d62cfeb9ad94920f78804 (patch)
treea4fc62468ad98fdff7b475906acf4ef048c209a4 /app/controllers/ci
parent1eb3dde45b55afb723954e577b7bd12946aeb3ca (diff)
downloadgitlab-ce-e41a29b0c381458f789d62cfeb9ad94920f78804.tar.gz
Allow to disable GitLab CI
Diffstat (limited to 'app/controllers/ci')
-rw-r--r--app/controllers/ci/application_controller.rb9
-rw-r--r--app/controllers/ci/projects_controller.rb8
2 files changed, 15 insertions, 2 deletions
diff --git a/app/controllers/ci/application_controller.rb b/app/controllers/ci/application_controller.rb
index d45c4e9caf1..8d8ff75ff72 100644
--- a/app/controllers/ci/application_controller.rb
+++ b/app/controllers/ci/application_controller.rb
@@ -1,5 +1,7 @@
module Ci
class ApplicationController < ::ApplicationController
+ before_action :check_enable_flag!
+
def self.railtie_helpers_paths
"app/helpers/ci"
end
@@ -8,6 +10,13 @@ module Ci
private
+ def check_enable_flag!
+ unless current_application_settings.ci_enabled
+ redirect_to(disabled_ci_projects_path)
+ return
+ end
+ end
+
def authenticate_public_page!
unless project.public
authenticate_user!
diff --git a/app/controllers/ci/projects_controller.rb b/app/controllers/ci/projects_controller.rb
index 653384b7178..b1f1c087b9e 100644
--- a/app/controllers/ci/projects_controller.rb
+++ b/app/controllers/ci/projects_controller.rb
@@ -5,13 +5,17 @@ module Ci
before_action :authenticate_user!, except: [:build, :badge, :index, :show]
before_action :authenticate_public_page!, only: :show
before_action :project, only: [:build, :integration, :show, :badge, :edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
- before_action :authorize_access_project!, except: [:build, :badge, :index, :show, :new, :create]
+ before_action :authorize_access_project!, except: [:build, :badge, :index, :show, :new, :create, :disabled]
before_action :authorize_manage_project!, only: [:edit, :integration, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
before_action :authenticate_token!, only: [:build]
before_action :no_cache, only: [:badge]
+ skip_before_action :check_enable_flag!, only: [:disabled]
protect_from_forgery except: :build
- layout 'ci/project', except: :index
+ layout 'ci/project', except: [:index, :disabled]
+
+ def disabled
+ end
def index
@limit, @offset = (params[:limit] || PROJECTS_BATCH).to_i, (params[:offset] || 0).to_i