diff options
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 |