File: configuration_controller.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (41 lines) | stat: -rw-r--r-- 1,027 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

module Projects
  module Security
    class ConfigurationController < Projects::ApplicationController
      include SecurityAndCompliancePermissions

      feature_category :static_application_security_testing, [:show]
      urgency :low, [:show]

      def show
        render_403 unless can?(current_user, :read_security_configuration, project)

        @configuration ||= configuration_presenter

        respond_to do |format|
          format.html
          format.json do
            render status: :ok, json: configuration.to_h
          end
        end
      end

      private

      def configuration
        configuration_presenter
      end

      def configuration_presenter
        ::Projects::Security::ConfigurationPresenter.new(project, **presenter_attributes, current_user: current_user)
      end

      def presenter_attributes
        {}
      end
    end
  end
end

Projects::Security::ConfigurationController.prepend_mod_with('Projects::Security::ConfigurationController')