2018-12-13 14:17:19 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class SuggestionPolicy < BasePolicy
|
2022-03-23 20:07:27 -04:00
|
|
|
delegate { @subject.source_project }
|
2018-12-13 14:17:19 -05:00
|
|
|
|
|
|
|
condition(:can_push_to_branch) do
|
2022-03-23 20:07:27 -04:00
|
|
|
Gitlab::UserAccess.new(@user, container: @subject.source_project).can_push_to_branch?(@subject.branch)
|
2018-12-13 14:17:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
rule { can_push_to_branch }.enable :apply_suggestion
|
|
|
|
end
|