debian-mirror-gitlab/app/controllers/projects/runner_projects_controller.rb

27 lines
655 B
Ruby
Raw Normal View History

2015-12-23 02:04:40 +05:30
class Projects::RunnerProjectsController < Projects::ApplicationController
2016-04-02 18:10:28 +05:30
before_action :authorize_admin_build!
2015-12-23 02:04:40 +05:30
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.runner_projects.find(params[:id])
runner_project.destroy
redirect_to runners_path(project)
end
end