Commit f549b01a authored by Nick Thomas's avatar Nick Thomas

Fix conflicts in Gitlab::GitAccessWiki and specs

parent ab65d03b
module Gitlab module Gitlab
class GitAccessWiki < GitAccess class GitAccessWiki < GitAccess
ERROR_MESSAGES = { ERROR_MESSAGES = {
geo: "You can't push code to a secondary GitLab Geo node.",
write_to_wiki: "You are not allowed to write to this project's wiki." write_to_wiki: "You are not allowed to write to this project's wiki."
}.freeze }.freeze
...@@ -13,17 +14,12 @@ module Gitlab ...@@ -13,17 +14,12 @@ module Gitlab
end end
def check_single_change_access(change) def check_single_change_access(change)
<<<<<<< HEAD
if Gitlab::Geo.enabled? && Gitlab::Geo.secondary? if Gitlab::Geo.enabled? && Gitlab::Geo.secondary?
build_status_object(false, "You can't push code to a secondary GitLab Geo node.") raise UnauthorizedError, ERROR_MESSAGES[:geo]
elsif user_access.can_do_action?(:create_wiki) end
build_status_object(true)
else
build_status_object(false, "You are not allowed to write to this project's wiki.")
=======
unless user_access.can_do_action?(:create_wiki) unless user_access.can_do_action?(:create_wiki)
raise UnauthorizedError, ERROR_MESSAGES[:write_to_wiki] raise UnauthorizedError, ERROR_MESSAGES[:write_to_wiki]
>>>>>>> ce/master
end end
true true
......
...@@ -22,20 +22,15 @@ describe Gitlab::GitAccessWiki, lib: true do ...@@ -22,20 +22,15 @@ describe Gitlab::GitAccessWiki, lib: true do
subject { access.check('git-receive-pack', changes) } subject { access.check('git-receive-pack', changes) }
<<<<<<< HEAD it { expect { subject }.not_to raise_error }
it { expect(subject.allowed?).to be_truthy }
context 'when in a secondary gitlab geo node' do context 'when in a secondary gitlab geo node' do
before do before do
allow(Gitlab::Geo).to receive(:enabled?) { true } allow(Gitlab::Geo).to receive(:enabled?) { true }
allow(Gitlab::Geo).to receive(:secondary?) { true } allow(Gitlab::Geo).to receive(:secondary?) { true }
end end
=======
it { expect { subject }.not_to raise_error }
end
>>>>>>> ce/master
it { expect(subject.allowed?).to be_falsey } it { expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError, "You can't push code to a secondary GitLab Geo node.") }
end end
end end
end end
......
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