Commit 15c9b7ea authored by Yorick Peterse's avatar Yorick Peterse

Move EE code out of Gitlab::GitAccess

This moves EE specific code out of Gitlab::GitAccess and into
EE::Gitlab::GitAccess. This commit also removes a few redundant comments
that were not present in CE.
parent d75ade01
......@@ -5,6 +5,8 @@ module EE
module GitAccess
prepend GeoGitAccess
extend ::Gitlab::Utils::Override
include ActionView::Helpers::SanitizeHelper
include PathLocksHelper
override :check
def check(cmd, changes)
......
......@@ -4,9 +4,6 @@
# class return an instance of `GitlabAccessStatus`
module Gitlab
class GitAccess
prepend ::EE::Gitlab::GitAccess # rubocop: disable Cop/InjectEnterpriseEditionModule
include ActionView::Helpers::SanitizeHelper
include PathLocksHelper
include Gitlab::Utils::StrongMemoize
UnauthorizedError = Class.new(StandardError)
......@@ -249,22 +246,18 @@ module Gitlab
end
end
# TODO: please clean this up
def check_push_access!
if project.repository_read_only?
# The repository is temporarily read-only. Please try again later.
raise UnauthorizedError, ERROR_MESSAGES[:read_only]
end
if deploy_key?
unless deploy_key.can_push_to?(project)
# This deploy key does not have write access to this project.
raise UnauthorizedError, ERROR_MESSAGES[:deploy_key_upload]
end
elsif user
# User access is verified in check_change_access!
else
# You are not allowed to upload code for this project.
raise UnauthorizedError, ERROR_MESSAGES[:upload]
end
......@@ -407,3 +400,5 @@ module Gitlab
end
end
end
Gitlab::GitAccess.prepend(EE::Gitlab::GitAccess)
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