055afab5c7
This MR simplifies CI permission model: - read_build: allows to read a list of builds, artifacts and trace - update_build: allows to cancel and retry builds - create_build: allows to create builds from gitlab-ci.yml (not yet implemented) - admin_build: allows to manage triggers, runners and variables - read_commit_status: allows to read a list of commit statuses (including the overall of builds) - create_commit_status: allows to create a new commit status using API Remove all extra methods to manage permission. Made all controllers to use explicitly the new permissions.
26 lines
655 B
Ruby
26 lines
655 B
Ruby
class Projects::RunnerProjectsController < Projects::ApplicationController
|
|
before_action :authorize_admin_build!
|
|
|
|
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
|