Commit 5bdad43e authored by Jonathan Schafer's avatar Jonathan Schafer

Set default for first class vulnerabilities to on

This will enable the first class vulnerabilities feature flag by
default.
Removes the feature flag restriction from the graphql.
parent 2ae41816
......@@ -3,7 +3,7 @@ class Groups::Security::DashboardController < Groups::ApplicationController
layout 'group'
before_action only: [:show] do
push_frontend_feature_flag(:first_class_vulnerabilities)
push_frontend_feature_flag(:first_class_vulnerabilities, default_enabled: true)
end
def show
......
......@@ -9,7 +9,7 @@ module Projects
before_action only: [:index] do
push_frontend_feature_flag(:hide_dismissed_vulnerabilities)
push_frontend_feature_flag(:first_class_vulnerabilities, @project)
push_frontend_feature_flag(:first_class_vulnerabilities, @project, default_enabled: true)
end
def index
......
......@@ -3,7 +3,7 @@
module Security
class DashboardController < ::Security::ApplicationController
before_action only: [:show] do
push_frontend_feature_flag(:first_class_vulnerabilities)
push_frontend_feature_flag(:first_class_vulnerabilities, default_enabled: true)
end
end
end
......@@ -148,7 +148,7 @@ module EE
end
def first_class_vulnerabilities_available?(project)
::Feature.enabled?(:first_class_vulnerabilities, project)
::Feature.enabled?(:first_class_vulnerabilities, project, default_enabled: true)
end
def merge_pipelines_available?
......
......@@ -313,7 +313,7 @@ module EE
end
def first_class_vulnerabilities_enabled?
::Feature.enabled?(:first_class_vulnerabilities, self)
::Feature.enabled?(:first_class_vulnerabilities, self, default_enabled: true)
end
def feature_available?(feature, user = nil)
......
......@@ -138,7 +138,7 @@ module Vulnerabilities
def state
return 'dismissed' if dismissal_feedback.present?
return 'detected' unless Feature.enabled?(:first_class_vulnerabilities, project)
return 'detected' unless Feature.enabled?(:first_class_vulnerabilities, project, default_enabled: true)
if vulnerability.nil?
'detected'
......
......@@ -21,7 +21,7 @@
= link_to project_security_dashboard_index_path(@project), title: _('Security Dashboard') do
%span= _('Security Dashboard')
- if project_nav_tab?(:security) && Feature.enabled?(:first_class_vulnerabilities, @project)
- if project_nav_tab?(:security) && Feature.enabled?(:first_class_vulnerabilities, @project, default_enabled: true)
= nav_link(path: 'projects/security/vulnerabilities#index') do
= link_to project_security_vulnerabilities_path(@project), title: _('Vulnerability List') do
%span= _('Vulnerability List')
......
......@@ -34,7 +34,7 @@ module API
end
get ':id' do
vulnerability = find_and_authorize_vulnerability!(:read_vulnerability)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project, default_enabled: true)
render_vulnerability(vulnerability)
end
......@@ -44,7 +44,7 @@ module API
end
post ':id/resolve' do
vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project, default_enabled: true)
not_modified! if vulnerability.resolved?
......@@ -57,7 +57,7 @@ module API
end
post ':id/dismiss' do
vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project, default_enabled: true)
not_modified! if vulnerability.dismissed?
......@@ -70,7 +70,7 @@ module API
end
post ':id/confirm' do
vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project, default_enabled: true)
not_modified! if vulnerability.confirmed?
......@@ -87,7 +87,7 @@ module API
success EE::API::Entities::Vulnerability
end
before do
not_found! unless Feature.enabled?(:first_class_vulnerabilities, user_project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, user_project, default_enabled: true)
end
params do
use :pagination
......
......@@ -43,7 +43,7 @@ module API
end
before do
not_found! unless Feature.enabled?(:first_class_vulnerabilities, user_project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, user_project, default_enabled: true)
end
post ':id/vulnerability_exports' do
......@@ -55,7 +55,7 @@ module API
namespace do
before do
not_found! unless Feature.enabled?(:first_class_vulnerabilities)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, default_enabled: true)
end
params do
......
......@@ -33,7 +33,7 @@ module API
end
get ':id/issue_links' do
vulnerability = find_and_authorize_vulnerability!(:read_vulnerability)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project, default_enabled: true)
present vulnerability
.related_issues
......@@ -51,7 +51,7 @@ module API
end
post ':id/issue_links' do
vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability_issue_link)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project, default_enabled: true)
issue = find_project_issue(params[:target_issue_iid], vulnerability.project_id)
......@@ -69,7 +69,7 @@ module API
end
delete ':id/issue_links/:issue_link_id' do
vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability_issue_link)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project)
not_found! unless Feature.enabled?(:first_class_vulnerabilities, vulnerability.project, default_enabled: true)
issue_link = find_issue_link!
......
......@@ -121,14 +121,14 @@ describe ProjectsHelper do
subject { helper.project_security_dashboard_config(project, pipeline) }
it 'checks if first vulnerability class is enabled' do
expect(::Feature).to receive(:enabled?).with(:first_class_vulnerabilities, project)
expect(::Feature).to receive(:enabled?).with(:first_class_vulnerabilities, project, default_enabled: true)
subject
end
context 'when first first class vulnerabilities is enabled for project' do
before do
expect(::Feature).to receive(:enabled?).with(:first_class_vulnerabilities, project).and_return(true)
expect(::Feature).to receive(:enabled?).with(:first_class_vulnerabilities, project, default_enabled: true).and_return(true)
end
it 'checks if first vulnerability class is enabled' do
......@@ -141,7 +141,7 @@ describe ProjectsHelper do
context 'when first first class vulnerabilities is disabled for project' do
before do
expect(::Feature).to receive(:enabled?).with(:first_class_vulnerabilities, project).and_return(false)
expect(::Feature).to receive(:enabled?).with(:first_class_vulnerabilities, project, default_enabled: true).and_return(false)
end
it 'checks if first vulnerability class is enabled' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment