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.
34 lines
700 B
Ruby
34 lines
700 B
Ruby
class Projects::TriggersController < Projects::ApplicationController
|
|
before_action :authorize_admin_build!
|
|
|
|
layout 'project_settings'
|
|
|
|
def index
|
|
@triggers = project.triggers
|
|
@trigger = Ci::Trigger.new
|
|
end
|
|
|
|
def create
|
|
@trigger = project.triggers.new
|
|
@trigger.save
|
|
|
|
if @trigger.valid?
|
|
redirect_to namespace_project_triggers_path(@project.namespace, @project)
|
|
else
|
|
@triggers = project.triggers.select(&:persisted?)
|
|
render :index
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
trigger.destroy
|
|
|
|
redirect_to namespace_project_triggers_path(@project.namespace, @project)
|
|
end
|
|
|
|
private
|
|
|
|
def trigger
|
|
@trigger ||= project.triggers.find(params[:id])
|
|
end
|
|
end
|