summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 21:08:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 21:08:13 +0000
commitd3c29eae5c389e36d4751539fad0462053fb2b20 (patch)
treecc3ae497193f9334d0bc6ee4224637102f6e0d4e /lib
parentad4dbe36445360521fc73a57df13bc8f12eeaa92 (diff)
downloadgitlab-ce-d3c29eae5c389e36d4751539fad0462053fb2b20.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/projects.rb2
-rw-r--r--lib/gitlab/auth/o_auth/provider.rb6
-rw-r--r--lib/gitlab/gitaly_client.rb14
3 files changed, 22 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index f9d08881acf..ca55e6ac010 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -177,6 +177,7 @@ module API
use :create_params
end
post do
+ Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab/issues/21139')
attrs = declared_params(include_missing: false)
attrs = translate_params_for_compatibility(attrs)
filter_attributes_using_license!(attrs)
@@ -209,6 +210,7 @@ module API
end
# rubocop: disable CodeReuse/ActiveRecord
post "user/:user_id" do
+ Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab/issues/21139')
authenticated_as_admin!
user = User.find_by(id: params.delete(:user_id))
not_found!('User') unless user
diff --git a/lib/gitlab/auth/o_auth/provider.rb b/lib/gitlab/auth/o_auth/provider.rb
index e7d758353bf..4d6b95ecd1b 100644
--- a/lib/gitlab/auth/o_auth/provider.rb
+++ b/lib/gitlab/auth/o_auth/provider.rb
@@ -75,6 +75,12 @@ module Gitlab
config = config_for(name)
(config && config['label']) || LABELS[name] || name.titleize
end
+
+ def self.icon_for(name)
+ name = name.to_s
+ config = config_for(name)
+ config && config['icon']
+ end
end
end
end
diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb
index 4eb1ccf32ba..4b5455c0ec9 100644
--- a/lib/gitlab/gitaly_client.rb
+++ b/lib/gitlab/gitaly_client.rb
@@ -141,6 +141,20 @@ module Gitlab
# kwargs.merge(deadline: Time.now + 10)
# end
#
+ # The optional remote_storage keyword argument is used to enable
+ # inter-gitaly calls. Say you have an RPC that needs to pull data from
+ # one repository to another. For example, to fetch a branch from a
+ # (non-deduplicated) fork into the fork parent. In that case you would
+ # send an RPC call to the Gitaly server hosting the fork parent, and in
+ # the request, you would tell that Gitaly server to pull Git data from
+ # the fork. How does that Gitaly server connect to the Gitaly server the
+ # forked repo lives on? This is the problem `remote_storage:` solves: it
+ # adds address and authentication information to the call, as gRPC
+ # metadata (under the `gitaly-servers` header). The request would say
+ # "pull from repo X on gitaly-2". In the Ruby code you pass
+ # `remote_storage: 'gitaly-2'`. And then the metadata would say
+ # "gitaly-2 is at network address tcp://10.0.1.2:8075".
+ #
def self.call(storage, service, rpc, request, remote_storage: nil, timeout: default_timeout, &block)
self.measure_timings(service, rpc, request) do
self.execute(storage, service, rpc, request, remote_storage: remote_storage, timeout: timeout, &block)