mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 20:56:08 +10:00
This solves https://dev.gitlab.org/gitlab/gitlabhq/issues/2646 1. 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 - admin_build: allows to manage triggers, runners and variables - read_commit_status: allows to read a list of commit statuses (including the status of a build, but doesn't allow to see a build details) - create_commit_status: allows to create a new commit status using API 2. I do make sure that the proper permissions are used in all places where the CI can be shown. 3. Add the `read_build` ability if user is anonymous or guest and allow_guest_to_access_builds is enabled. 4. Add CI setting: public_builds. 5. The artifacts specific permission are removed, since they are covered by `*_build`.
27 lines
655 B
Ruby
27 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
|