Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-12-04 14:55:23 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2015-12-11 20:02:09 +0300
commite80e3f5372d6bcad1fbe04a85b3086bb66794828 (patch)
tree16b1539cfd158ecac7fe05d595cbba30b8bc1a04 /app/controllers/projects/runner_projects_controller.rb
parent8b4cdc50fca816b4f56f8579e17c4dba836ec797 (diff)
Migrate CI::Project to Project
Diffstat (limited to 'app/controllers/projects/runner_projects_controller.rb')
-rw-r--r--app/controllers/projects/runner_projects_controller.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/controllers/projects/runner_projects_controller.rb b/app/controllers/projects/runner_projects_controller.rb
new file mode 100644
index 00000000000..69863387354
--- /dev/null
+++ b/app/controllers/projects/runner_projects_controller.rb
@@ -0,0 +1,26 @@
+class Projects::RunnerProjectsController < Projects::ApplicationController
+ before_action :authorize_admin_project!
+
+ layout 'project_settings'
+
+ def create
+ @runner = Ci::Runner.find(params[:runner_project][:runner_id])
+
+ return head(403) unless current_user.ci_authorized_runners.include?(@runner)
+
+ path = runners_path(project)
+
+ if @runner.assign_to(project, current_user)
+ redirect_to path
+ else
+ redirect_to path, alert: 'Failed adding runner to project'
+ end
+ end
+
+ def destroy
+ runner_project = project.ci_runner_projects.find(params[:id])
+ runner_project.destroy
+
+ redirect_to runners_path(project)
+ end
+end