Commit b7cf43b2 authored by Peter Leitzen's avatar Peter Leitzen

Tweak permission check from maintainer to developer

parent fce3f611
...@@ -240,8 +240,6 @@ module EE ...@@ -240,8 +240,6 @@ module EE
rule { prometheus_alerts_enabled & can?(:maintainer_access) }.enable :read_prometheus_alerts rule { prometheus_alerts_enabled & can?(:maintainer_access) }.enable :read_prometheus_alerts
rule { status_page_available & can?(:maintainer_access) }.enable :publish_status_page
rule { auditor }.policy do rule { auditor }.policy do
enable :public_user_access enable :public_user_access
prevent :request_access prevent :request_access
...@@ -373,6 +371,8 @@ module EE ...@@ -373,6 +371,8 @@ module EE
end end
rule { requirements_available & owner }.enable :destroy_requirement rule { requirements_available & owner }.enable :destroy_requirement
rule { status_page_available & can?(:developer_access) }.enable :publish_status_page
end end
override :lookup_access_level! override :lookup_access_level!
......
...@@ -23,7 +23,7 @@ module StatusPage ...@@ -23,7 +23,7 @@ module StatusPage
attr_reader :user, :project attr_reader :user, :project
def can_publish? def can_publish?
user.can?(:publish_status_page, project) user&.can?(:publish_status_page, project)
end end
def status_page_enabled? def status_page_enabled?
......
...@@ -1023,6 +1023,7 @@ describe ProjectPolicy do ...@@ -1023,6 +1023,7 @@ describe ProjectPolicy do
end end
describe 'publish_status_page' do describe 'publish_status_page' do
let(:anonymous) { nil }
let(:feature) { :status_page } let(:feature) { :status_page }
let(:policy) { :publish_status_page } let(:policy) { :publish_status_page }
...@@ -1030,16 +1031,17 @@ describe ProjectPolicy do ...@@ -1030,16 +1031,17 @@ describe ProjectPolicy do
using RSpec::Parameterized::TableSyntax using RSpec::Parameterized::TableSyntax
where(:role, :allowed) do where(:role, :allowed) do
:anonymous | false
:guest | false :guest | false
:reporter | false :reporter | false
:developer | false :developer | true
:maintainer | true :maintainer | true
:owner | true :owner | true
:admin | true :admin | true
end end
with_them do with_them do
let(:current_user) { public_send(role) } let(:current_user) { public_send(role) if role }
before do before do
stub_feature_flags(feature => true) stub_feature_flags(feature => true)
......
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