diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 96979398c83574fd058718f91494fcdd6d2918a8..b462cffeaf6410d825e58541c0477dab35ae301d 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -138,9 +138,7 @@ module Gitlab # Iterate over all changes to find if user allowed all of them to be applied changes_list.each do |change| - status = Checks::ChangeAccess.new(change, - user_access: user_access, - project: project).exec + status = check_single_change_access(change) unless status.allowed? # If user does not have access to make at least one change - cancel all push raise UnauthorizedError, status.message @@ -148,6 +146,11 @@ module Gitlab end end + def check_single_change_access(change) + Checks::ChangeAccess.new( + change, user_access: user_access, project: project).exec + end + def matching_merge_request?(newrev, branch_name) Checks::MatchingMergeRequest.new(newrev, branch_name, project).match? end diff --git a/lib/gitlab/git_access_wiki.rb b/lib/gitlab/git_access_wiki.rb index f71d3575909c68567203edd33958e3da97b5dea9..f7976a64ef5b48cc05b043ffc34f8ce347c73e16 100644 --- a/lib/gitlab/git_access_wiki.rb +++ b/lib/gitlab/git_access_wiki.rb @@ -1,6 +1,6 @@ module Gitlab class GitAccessWiki < GitAccess - def change_access_check(change) + def check_single_change_access(change) if user_access.can_do_action?(:create_wiki) build_status_object(true) else