Commit 9cbcd585 authored by Dan Jensen's avatar Dan Jensen Committed by Dmytro Zaporozhets (DZ)

Fix AccessDeniedError in Compliance Dashboard seed

This removes logic that chooses an arbitrary maintainer in favor of
what was previously the fallback logic that chooses an arbitrary admin.
The thinking is that this simplifies the code in favor of logic that
should be more reliable overall.
parent 3a6dbbe7
......@@ -9,6 +9,10 @@ class Gitlab::Seeder::ComplianceDashboardMergeRequests
@project = project
end
def admin
@admin ||= create(:user, :admin)
end
def seed!
used_statuses = []
......@@ -54,10 +58,8 @@ class Gitlab::Seeder::ComplianceDashboardMergeRequests
state: :opened
}
maintainer = @project.team.maintainers.sample || User.admins.first
Sidekiq::Worker.skipping_transaction_check do
merge_request = MergeRequests::CreateService.new(@project, maintainer, opts).execute
merge_request = MergeRequests::CreateService.new(@project, admin, opts).execute
merge_request.save!
merge_request.approvals.create(approvals)
merge_request.state = :merged
......
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