Commit 5da9bfa4 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Fix test for GitAccessWiki, it's overriding change_access_check

parent 40632455
...@@ -138,9 +138,7 @@ module Gitlab ...@@ -138,9 +138,7 @@ module Gitlab
# Iterate over all changes to find if user allowed all of them to be applied # Iterate over all changes to find if user allowed all of them to be applied
changes_list.each do |change| changes_list.each do |change|
status = Checks::ChangeAccess.new(change, status = check_single_change_access(change)
user_access: user_access,
project: project).exec
unless status.allowed? unless status.allowed?
# If user does not have access to make at least one change - cancel all push # If user does not have access to make at least one change - cancel all push
raise UnauthorizedError, status.message raise UnauthorizedError, status.message
...@@ -148,6 +146,11 @@ module Gitlab ...@@ -148,6 +146,11 @@ module Gitlab
end end
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) def matching_merge_request?(newrev, branch_name)
Checks::MatchingMergeRequest.new(newrev, branch_name, project).match? Checks::MatchingMergeRequest.new(newrev, branch_name, project).match?
end end
......
module Gitlab module Gitlab
class GitAccessWiki < GitAccess class GitAccessWiki < GitAccess
def change_access_check(change) def check_single_change_access(change)
if user_access.can_do_action?(:create_wiki) if user_access.can_do_action?(:create_wiki)
build_status_object(true) build_status_object(true)
else else
......
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