summaryrefslogtreecommitdiff
path: root/app/controllers/groups/settings/ci_cd_controller.rb
blob: 0142ad8278c38ac82157874e7431b7c159cda8c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module Groups
  module Settings
    class CiCdController < Groups::ApplicationController
      before_action :authorize_admin_pipeline!

      def show
        define_secret_variables
      end

      private

      def define_secret_variables
        @variable = Ci::GroupVariable.new(group: group)
          .present(current_user: current_user)
        @variables = group.variables.order_key_asc
          .map { |variable| variable.present(current_user: current_user) }
      end

      def authorize_admin_pipeline!
        return render_404 unless can?(current_user, :admin_pipeline, group)
      end
    end
  end
end