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