Commit 986beb89 authored by Jonathan Schafer's avatar Jonathan Schafer

Checks project feature flag for 1st class vulns

parent 960eff07
...@@ -6,8 +6,8 @@ module API ...@@ -6,8 +6,8 @@ module API
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
before do after do
not_found! unless Feature.enabled?(:first_class_vulnerabilities) not_found! unless Feature.enabled?(:first_class_vulnerabilities, @project)
authenticate! authenticate!
end end
......
...@@ -34,6 +34,7 @@ module API ...@@ -34,6 +34,7 @@ module API
end end
get ':id' do get ':id' do
vulnerability = Vulnerability.find(params[:id]) vulnerability = Vulnerability.find(params[:id])
@project = vulnerability.project
authorize_vulnerability!(vulnerability, :read_vulnerability) authorize_vulnerability!(vulnerability, :read_vulnerability)
render_vulnerability(vulnerability) render_vulnerability(vulnerability)
end end
...@@ -43,6 +44,7 @@ module API ...@@ -43,6 +44,7 @@ module API
end end
post ':id/resolve' do post ':id/resolve' do
vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability) vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability)
@project = vulnerability.project
break not_modified! if vulnerability.resolved? break not_modified! if vulnerability.resolved?
vulnerability = ::Vulnerabilities::ResolveService.new(current_user, vulnerability).execute vulnerability = ::Vulnerabilities::ResolveService.new(current_user, vulnerability).execute
...@@ -54,6 +56,7 @@ module API ...@@ -54,6 +56,7 @@ module API
end end
post ':id/dismiss' do post ':id/dismiss' do
vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability) vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability)
@project = vulnerability.project
break not_modified! if vulnerability.dismissed? break not_modified! if vulnerability.dismissed?
vulnerability = ::Vulnerabilities::DismissService.new(current_user, vulnerability).execute vulnerability = ::Vulnerabilities::DismissService.new(current_user, vulnerability).execute
...@@ -65,6 +68,7 @@ module API ...@@ -65,6 +68,7 @@ module API
end end
post ':id/confirm' do post ':id/confirm' do
vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability) vulnerability = find_and_authorize_vulnerability!(:admin_vulnerability)
@project = vulnerability.project
break not_modified! if vulnerability.confirmed? break not_modified! if vulnerability.confirmed?
vulnerability = ::Vulnerabilities::ConfirmService.new(current_user, vulnerability).execute vulnerability = ::Vulnerabilities::ConfirmService.new(current_user, vulnerability).execute
......
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