2020-09-28 05:09:35 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
2020-10-14 20:08:42 -04:00
|
|
|
class DebianGroupPackages < ::API::Base
|
2021-07-27 08:10:54 -04:00
|
|
|
PACKAGE_FILE_REQUIREMENTS = ::API::DebianProjectPackages::PACKAGE_FILE_REQUIREMENTS.merge(
|
|
|
|
project_id: %r{[0-9]+}.freeze
|
|
|
|
).freeze
|
2020-09-28 05:09:35 -04:00
|
|
|
|
|
|
|
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
|
2021-07-27 08:10:54 -04:00
|
|
|
helpers do
|
|
|
|
def user_project
|
|
|
|
@project ||= find_project!(params[:project_id])
|
|
|
|
end
|
2021-06-14 14:10:28 -04:00
|
|
|
|
2021-07-27 08:10:54 -04:00
|
|
|
def project_or_group
|
|
|
|
user_group
|
|
|
|
end
|
2021-06-14 14:10:28 -04:00
|
|
|
end
|
|
|
|
|
2021-07-27 08:10:54 -04:00
|
|
|
after_validation do
|
2021-02-01 01:09:16 -05:00
|
|
|
require_packages_enabled!
|
|
|
|
|
2021-07-26 17:08:38 -04:00
|
|
|
not_found! unless ::Feature.enabled?(:debian_group_packages, user_group)
|
2020-09-28 05:09:35 -04:00
|
|
|
|
|
|
|
authorize_read_package!(user_group)
|
|
|
|
end
|
|
|
|
|
2021-07-27 08:10:54 -04:00
|
|
|
params do
|
|
|
|
requires :id, type: String, desc: 'The ID of a group'
|
|
|
|
end
|
2021-06-21 23:07:55 -04:00
|
|
|
|
2021-07-27 08:10:54 -04:00
|
|
|
namespace ':id/-/packages/debian' do
|
2021-06-14 14:10:28 -04:00
|
|
|
include ::API::Concerns::Packages::DebianPackageEndpoints
|
2021-07-27 08:10:54 -04:00
|
|
|
|
2021-11-03 08:10:26 -04:00
|
|
|
# GET groups/:id/-/packages/debian/pool/:distribution/:project_id/:letter/:package_name/:package_version/:file_name
|
2021-07-27 08:10:54 -04:00
|
|
|
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
|
|
|
|
present_package_file!
|
|
|
|
end
|
2020-09-28 05:09:35 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|