diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /lib/api/project_debian_distributions.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'lib/api/project_debian_distributions.rb')
-rw-r--r-- | lib/api/project_debian_distributions.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/api/project_debian_distributions.rb b/lib/api/project_debian_distributions.rb new file mode 100644 index 00000000000..58edf51f4f7 --- /dev/null +++ b/lib/api/project_debian_distributions.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module API + class ProjectDebianDistributions < ::API::Base + params do + requires :id, type: String, desc: 'The ID of a project' + end + + resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do + rescue_from ArgumentError do |e| + render_api_error!(e.message, 400) + end + + rescue_from ActiveRecord::RecordInvalid do |e| + render_api_error!(e.message, 400) + end + + after_validation do + require_packages_enabled! + + not_found! unless ::Feature.enabled?(:debian_packages, user_project) + + authorize_read_package! + end + + namespace ':id' do + helpers do + def project_or_group + user_project + end + end + + include ::API::Concerns::Packages::DebianDistributionEndpoints + end + end + end +end |