Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities/group_detail.rb1
-rw-r--r--lib/api/helpers/groups_helpers.rb1
-rw-r--r--lib/api/usage_data.rb29
3 files changed, 31 insertions, 0 deletions
diff --git a/lib/api/entities/group_detail.rb b/lib/api/entities/group_detail.rb
index f3d64315203..9f3ced7d717 100644
--- a/lib/api/entities/group_detail.rb
+++ b/lib/api/entities/group_detail.rb
@@ -7,6 +7,7 @@ module API
SharedGroupWithGroup.represent(group.shared_with_group_links_visible_to_user(options[:current_user]))
end
expose :runners_token, if: ->(_, options) { options[:user_can_admin_group] }
+ expose :enabled_git_access_protocol, if: ->(group, options) { group.root? && options[:user_can_admin_group] }
expose :prevent_sharing_groups_outside_hierarchy,
if: ->(group) { group.root? && group.namespace_settings.present? }
diff --git a/lib/api/helpers/groups_helpers.rb b/lib/api/helpers/groups_helpers.rb
index fbe13bfe8f7..1861ef7c402 100644
--- a/lib/api/helpers/groups_helpers.rb
+++ b/lib/api/helpers/groups_helpers.rb
@@ -35,6 +35,7 @@ module API
optional :developer_can_initial_push, type: Boolean, desc: 'Allow developers to initial push'
end
optional :shared_runners_setting, type: String, values: ::Namespace::SHARED_RUNNERS_SETTINGS, desc: 'Enable/disable shared runners for the group and its subgroups and projects'
+ optional :enabled_git_access_protocol, type: String, values: %w[ssh http all], desc: 'Allow only the selected protocols to be used for Git access.'
end
params :optional_params_ee do
diff --git a/lib/api/usage_data.rb b/lib/api/usage_data.rb
index 0d1c6cb2281..67bf2725988 100644
--- a/lib/api/usage_data.rb
+++ b/lib/api/usage_data.rb
@@ -2,6 +2,8 @@
module API
class UsageData < ::API::Base
+ include APIGuard
+
before { authenticate_non_get! }
feature_category :service_ping
@@ -12,6 +14,33 @@ module API
forbidden!('Invalid CSRF token is provided') unless verified_request?
end
+ resource :service_ping do
+ allow_access_with_scope :read_service_ping
+
+ before do
+ authenticated_as_admin!
+ end
+
+ desc 'Get the latest ServicePing payload' do
+ detail 'Introduces in Gitlab 16.9. Requires Personal Access Token with read_service_ping scope.'
+ success code: 200
+ failure [
+ { code: 401, message: '401 Unauthorized' },
+ { code: 403, message: 'Forbidden' },
+ { code: 404, message: 'Not found' }
+ ]
+ tags %w[usage_data]
+ produces ['application/json']
+ end
+
+ get do
+ content_type 'application/json'
+
+ Rails.cache.fetch(Gitlab::Usage::ServicePingReport::CACHE_KEY) ||
+ ::RawUsageData.for_current_reporting_cycle.first&.payload || {}
+ end
+ end
+
desc 'Track usage data event' do
detail 'This feature was introduced in GitLab 13.4.'
success code: 200