Commit 239b48a6 authored by Peter Leitzen's avatar Peter Leitzen Committed by Sean McGivern

Grant alert bot reporter access programmatically

Before this commit the alert bot could not create labels on project
with private issue access ALTHOUGH it has `:reporter_access`.

Reason: In order to check project `issues_disabled` rule we check user's
team access level. AFAIK, there's no way to utilize `:reporter_access`.
parent e10c552d
......@@ -97,8 +97,6 @@ module EE
prevent :read_project
end
rule { alert_bot }.enable :reporter_access
rule { license_block }.policy do
prevent :create_issue
prevent :create_merge_request_in
......@@ -266,7 +264,8 @@ module EE
override :lookup_access_level!
def lookup_access_level!
return ::GroupMember::NO_ACCESS if needs_new_sso_session?
return ::Gitlab::Access::NO_ACCESS if needs_new_sso_session?
return ::Gitlab::Access::REPORTER if alert_bot?
super
end
......
......@@ -828,6 +828,12 @@ describe ProjectPolicy do
let(:current_user) { User.alert_bot }
it { is_expected.to be_allowed(:reporter_access) }
context 'within a private project' do
let(:project) { create(:project, :private) }
it { is_expected.to be_allowed(:admin_issue) }
end
end
context 'commit_committer_check is not enabled by the current license' 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