Extract EE specific files/lines for lib/gitlab (harder but less)
We have the following files containing EE specific code. We should move them to ee/
lib/gitlab/git_access.rb
diff --git a/lib/gitlab/git_access.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/git_access.rb
index 010bd0e520c..dc3ca042781 100644
--- a/lib/gitlab/git_access.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/git_access.rb
@@ -4,6 +4,9 @@
# 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)
@@ -246,18 +249,22 @@ 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
lib/gitlab/usage_data.rb
diff --git a/lib/gitlab/usage_data.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/usage_data.rb
index 0101ccc046a..a671d42104d 100644
--- a/lib/gitlab/usage_data.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/usage_data.rb
@@ -5,6 +5,8 @@ module Gitlab
APPROXIMATE_COUNT_MODELS = [Label, MergeRequest, Note, Todo].freeze
class << self
+ prepend EE::Gitlab::UsageData # rubocop: disable Cop/InjectEnterpriseEditionModule
+
def data(force_refresh: false)
Rails.cache.fetch('usage_data', force: force_refresh, expires_in: 2.weeks) { uncached_data }
end
@@ -29,7 +31,7 @@ module Gitlab
installation_type: Gitlab::INSTALLATION_TYPE,
active_user_count: count(User.active),
recorded_at: Time.now,
- edition: 'CE'
+ edition: 'EE'
}
usage_data
Edited by Dave Smith