Skip to content
Snippets Groups Projects

Add `admin_runners` custom role permission

Merged mo khan requested to merge mokhax/442851/admin_runners into master
All threads resolved!
Compare and Show latest version
13 files
+ 150
52
Compare changes
  • Side-by-side
  • Inline
Files
13
@@ -9,7 +9,7 @@ class CiCdController < Projects::ApplicationController
@@ -9,7 +9,7 @@ class CiCdController < Projects::ApplicationController
layout 'project_settings'
layout 'project_settings'
before_action :authorize_admin_pipeline!, except: :show
before_action :authorize_admin_pipeline!, except: :show
before_action :authorize_admin_cicd_variables!, only: :show
before_action :authorize_admin_cicd_settings!, only: :show
before_action :check_builds_available!
before_action :check_builds_available!
before_action :define_variables
before_action :define_variables
@@ -75,6 +75,18 @@ def runner_setup_scripts
@@ -75,6 +75,18 @@ def runner_setup_scripts
private
private
 
def authorize_admin_cicd_settings!
 
return if can_any?(:admin_cicd_variables, :admin_runner, :admin_pipeline)
 
 
access_denied!
 
end
 
 
def can_any?(*permissions)
 
permissions.find do |permission|
 
can?(current_user, permission, project)
 
end
 
end
 
def highlight_badge(name, content, language = nil)
def highlight_badge(name, content, language = nil)
Gitlab::Highlight.highlight(name, content, language: language)
Gitlab::Highlight.highlight(name, content, language: language)
end
end
Loading