debian-mirror-gitlab/app/controllers/projects/security/configuration_controller.rb

51 lines
1.3 KiB
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
module Projects
module Security
class ConfigurationController < Projects::ApplicationController
2021-04-17 20:07:23 +05:30
include SecurityAndCompliancePermissions
2021-11-18 22:05:49 +05:30
feature_category :static_application_security_testing, [:show]
2021-03-11 19:13:27 +05:30
def show
render_403 unless can?(current_user, :read_security_configuration, project)
2022-03-02 08:16:31 +05:30
2022-04-04 11:22:00 +05:30
@configuration ||= configuration_presenter
2022-03-02 08:16:31 +05:30
respond_to do |format|
format.html
format.json do
render status: :ok, json: configuration.to_h
end
end
end
private
def configuration
if unify_configuration_enabled?
configuration_presenter
else
{}
end
end
def configuration_presenter
::Projects::Security::ConfigurationPresenter.new(project,
**presenter_attributes,
current_user: current_user)
end
def presenter_attributes
{}
end
def unify_configuration_enabled?
Feature.enabled?(:unify_security_configuration, project, default_enabled: :yaml)
2021-03-11 19:13:27 +05:30
end
end
end
end
2021-06-08 01:23:25 +05:30
Projects::Security::ConfigurationController.prepend_mod_with('Projects::Security::ConfigurationController')