2021-01-03 14:25:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
|
|
|
class DebianGroupPackages < ::API::Base
|
2021-10-27 15:23:28 +05:30
|
|
|
PACKAGE_FILE_REQUIREMENTS = ::API::DebianProjectPackages::PACKAGE_FILE_REQUIREMENTS.merge(
|
|
|
|
project_id: %r{[0-9]+}.freeze
|
|
|
|
).freeze
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
before do
|
|
|
|
not_found! if Gitlab::FIPS.enabled?
|
|
|
|
end
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
|
2021-10-27 15:23:28 +05:30
|
|
|
helpers do
|
|
|
|
def user_project
|
|
|
|
@project ||= find_project!(params[:project_id])
|
|
|
|
end
|
2021-09-04 01:27:46 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
def project_or_group
|
|
|
|
user_group
|
|
|
|
end
|
2021-09-04 01:27:46 +05:30
|
|
|
end
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
after_validation do
|
2021-03-11 19:13:27 +05:30
|
|
|
require_packages_enabled!
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
not_found! unless ::Feature.enabled?(:debian_group_packages, user_group)
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
authorize_read_package!(user_group)
|
|
|
|
end
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
params do
|
|
|
|
requires :id, type: String, desc: 'The ID of a group'
|
|
|
|
end
|
2021-09-30 23:02:18 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
namespace ':id/-/packages/debian' do
|
2021-09-04 01:27:46 +05:30
|
|
|
include ::API::Concerns::Packages::DebianPackageEndpoints
|
2021-10-27 15:23:28 +05:30
|
|
|
|
2021-12-11 22:18:48 +05:30
|
|
|
# GET groups/:id/-/packages/debian/pool/:distribution/:project_id/:letter/:package_name/:package_version/:file_name
|
2021-10-27 15:23:28 +05:30
|
|
|
params do
|
|
|
|
requires :project_id, type: Integer, desc: 'The Project Id'
|
|
|
|
use :shared_package_file_params
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'The package' do
|
|
|
|
detail 'This feature was introduced in GitLab 14.2'
|
|
|
|
end
|
|
|
|
|
|
|
|
route_setting :authentication, authenticate_non_public: true
|
|
|
|
get 'pool/:distribution/:project_id/:letter/:package_name/:package_version/:file_name', requirements: PACKAGE_FILE_REQUIREMENTS do
|
2022-10-11 01:57:18 +05:30
|
|
|
present_distribution_package_file!
|
2021-10-27 15:23:28 +05:30
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|