diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 09:16:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 09:16:11 +0000 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /app/controllers/projects/security/configuration_controller.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) | |
download | gitlab-ce-edaa33dee2ff2f7ea3fac488d41558eb5f86d68c.tar.gz |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'app/controllers/projects/security/configuration_controller.rb')
-rw-r--r-- | app/controllers/projects/security/configuration_controller.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/controllers/projects/security/configuration_controller.rb b/app/controllers/projects/security/configuration_controller.rb index 444f4783a19..14f765814e6 100644 --- a/app/controllers/projects/security/configuration_controller.rb +++ b/app/controllers/projects/security/configuration_controller.rb @@ -9,6 +9,37 @@ module Projects def show render_403 unless can?(current_user, :read_security_configuration, project) + + 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) end end end |