Skip to content
Snippets Groups Projects
Commit 7a0d3ec4 authored by Zamir Martins's avatar Zamir Martins :speech_balloon:
Browse files

Merge branch 'remove_unused_json_from_configuration' into 'master'

Remove unused json rendering from configuration controllers

See merge request gitlab-org/gitlab!108854



Merged-by: default avatarZamir Martins <zfilho@gitlab.com>
Reviewed-by: default avatarTetiana Chupryna <tchupryna@gitlab.com>
Reviewed-by: default avatarMohamed Hamda <mhamda@gitlab.com>
parents de1f6380 cd26669a
No related branches found
No related tags found
No related merge requests found
......@@ -12,25 +12,10 @@ 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
if unify_configuration_enabled?
configuration_presenter
else
{}
end
end
def configuration_presenter
::Projects::Security::ConfigurationPresenter.new(project,
**presenter_attributes,
......@@ -40,10 +25,6 @@ def configuration_presenter
def presenter_attributes
{}
end
def unify_configuration_enabled?
Feature.enabled?(:unify_security_configuration, project)
end
end
end
end
......
---
name: unify_security_configuration
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76866
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/350177
milestone: '14.7'
type: development
group: group::composition analysis
default_enabled: false
......@@ -33,13 +33,6 @@ def show
return super unless security_dashboard_feature_enabled? && can_read_security_dashboard?
@configuration ||= configuration_presenter
respond_to do |format|
format.html
format.json do
render status: :ok, json: @configuration.to_h
end
end
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
......
......@@ -59,16 +59,6 @@
sign_in(user)
end
it 'responds in json format when requested' do
get :show, params: { namespace_id: project.namespace, project_id: project, format: :json }
types = %w(sast sast_iac dast dast_profiles dependency_scanning container_scanning cluster_image_scanning secret_detection coverage_fuzzing license_scanning api_fuzzing corpus_management)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['features'].map { |f| f['type'] }).to match_array(types)
expect(json_response['auto_fix_enabled']).to include({ 'dependency_scanning' => true, 'container_scanning' => true })
end
it "renders data on the project's security configuration" do
request
......
......@@ -36,31 +36,6 @@
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:show)
end
it 'responds with configuration data json' do
get :show, params: { namespace_id: project.namespace, project_id: project, format: :json }
features = json_response['features']
sast_feature = features.find { |feature| feature['type'] == 'sast' }
dast_feature = features.find { |feature| feature['type'] == 'dast' }
expect(response).to have_gitlab_http_status(:ok)
expect(sast_feature['available']).to be_truthy
expect(dast_feature['available']).to be_falsey
end
context 'with feature flag unify_security_configuration turned off' do
before do
stub_feature_flags(unify_security_configuration: false)
end
it 'responds with empty configuration data json' do
get :show, params: { namespace_id: project.namespace, project_id: project, format: :json }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_empty
end
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment