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