debian-mirror-gitlab/lib/api/group_container_repositories.rb

47 lines
1.4 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
module API
2021-01-03 14:25:43 +05:30
class GroupContainerRepositories < ::API::Base
2019-10-12 21:52:04 +05:30
include PaginationParams
2021-11-18 22:05:49 +05:30
include ::API::Helpers::ContainerRegistryHelpers
2019-10-12 21:52:04 +05:30
2021-01-03 14:25:43 +05:30
helpers ::API::Helpers::PackagesHelpers
2019-10-12 21:52:04 +05:30
before { authorize_read_group_container_images! }
2022-07-16 23:28:13 +05:30
feature_category :container_registry
urgency :low
2021-01-29 00:20:46 +05:30
2019-10-12 21:52:04 +05:30
REPOSITORY_ENDPOINT_REQUIREMENTS = API::NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(
tag_name: API::NO_SLASH_URL_PART_REGEX)
params do
requires :id, type: String, desc: "Group's ID or path"
end
resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
desc 'Get a list of all repositories within a group' do
detail 'This feature was introduced in GitLab 12.2.'
success Entities::ContainerRegistry::Repository
end
params do
use :pagination
end
get ':id/registry/repositories' do
repositories = ContainerRepositoriesFinder.new(
2019-12-26 22:10:19 +05:30
user: current_user, subject: user_group
2019-10-12 21:52:04 +05:30
).execute
2021-09-04 01:27:46 +05:30
track_package_event('list_repositories', :container, user: current_user, namespace: user_group)
2019-12-26 22:10:19 +05:30
2022-07-16 23:28:13 +05:30
present paginate(repositories), with: Entities::ContainerRegistry::Repository, tags: false, tags_count: false
2019-10-12 21:52:04 +05:30
end
end
helpers do
def authorize_read_group_container_images!
authorize! :read_container_image, user_group
end
end
end
end