Commit b87f025a authored by James Lopez's avatar James Lopez

Merge branch 'fix_security_and_compliance_access_for_auditors' into 'master'

Fix "Security & Compliance" access for auditors

See merge request gitlab-org/gitlab!62837
parents 4dbcd621 9541fe04
...@@ -266,6 +266,10 @@ module EE ...@@ -266,6 +266,10 @@ module EE
enable :read_pages enable :read_pages
end end
rule { ~security_and_compliance_disabled & auditor }.policy do
enable :access_security_and_compliance
end
rule { auditor & security_dashboard_enabled }.policy do rule { auditor & security_dashboard_enabled }.policy do
enable :read_vulnerability enable :read_vulnerability
enable :read_vulnerability_scanner enable :read_vulnerability_scanner
......
...@@ -456,6 +456,28 @@ RSpec.describe ProjectPolicy do ...@@ -456,6 +456,28 @@ RSpec.describe ProjectPolicy do
end end
end end
describe 'access_security_and_compliance' do
context 'when the user is auditor' do
let(:current_user) { create(:user, :auditor) }
before do
project.project_feature.update!(security_and_compliance_access_level: access_level)
end
context 'when the "Security & Compliance" is not enabled' do
let(:access_level) { Featurable::DISABLED }
it { is_expected.to be_disallowed(:access_security_and_compliance) }
end
context 'when the "Security & Compliance" is enabled' do
let(:access_level) { Featurable::PRIVATE }
it { is_expected.to be_allowed(:access_security_and_compliance) }
end
end
end
describe 'vulnerability feedback permissions' do describe 'vulnerability feedback permissions' do
where(permission: %i[ where(permission: %i[
read_vulnerability_feedback read_vulnerability_feedback
......
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