diff options
Diffstat (limited to 'lib/api/concerns/packages')
-rw-r--r-- | lib/api/concerns/packages/debian_distribution_endpoints.rb | 8 | ||||
-rw-r--r-- | lib/api/concerns/packages/debian_package_endpoints.rb | 4 | ||||
-rw-r--r-- | lib/api/concerns/packages/nuget_endpoints.rb | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/api/concerns/packages/debian_distribution_endpoints.rb b/lib/api/concerns/packages/debian_distribution_endpoints.rb index 76b996f2301..6fe3f432edb 100644 --- a/lib/api/concerns/packages/debian_distribution_endpoints.rb +++ b/lib/api/concerns/packages/debian_distribution_endpoints.rb @@ -80,10 +80,10 @@ module API use :optional_distribution_params end post '/' do - authorize_create_package!(project_or_group) + authorize_create_package!(project_or_group(:read_project)) distribution_params = declared_params(include_missing: false) - result = ::Packages::Debian::CreateDistributionService.new(project_or_group, current_user, distribution_params).execute + result = ::Packages::Debian::CreateDistributionService.new(project_or_group(:read_project), current_user, distribution_params).execute created_distribution = result.payload[:distribution] if result.success? @@ -183,7 +183,7 @@ module API use :optional_distribution_params end put '/:codename' do - authorize_create_package!(project_or_group) + authorize_create_package!(project_or_group(:read_project)) distribution_params = declared_params(include_missing: false).except(:codename) result = ::Packages::Debian::UpdateDistributionService.new(distribution, distribution_params).execute @@ -214,7 +214,7 @@ module API use :optional_distribution_params end delete '/:codename' do - authorize_destroy_package!(project_or_group) + authorize_destroy_package!(project_or_group(:read_project)) accepted! if distribution.destroy diff --git a/lib/api/concerns/packages/debian_package_endpoints.rb b/lib/api/concerns/packages/debian_package_endpoints.rb index 842250d351b..181759a7f38 100644 --- a/lib/api/concerns/packages/debian_package_endpoints.rb +++ b/lib/api/concerns/packages/debian_package_endpoints.rb @@ -35,10 +35,10 @@ module API ::Packages::Debian::DistributionsFinder.new(container, codename_or_suite: params[:distribution]).execute.last! end - def present_distribution_package_file! + def present_distribution_package_file!(project) not_found! unless params[:package_name].start_with?(params[:letter]) - package_file = distribution_from!(user_project).package_files.with_file_name(params[:file_name]).last! + package_file = distribution_from!(project).package_files.with_file_name(params[:file_name]).last! present_package_file!(package_file) end diff --git a/lib/api/concerns/packages/nuget_endpoints.rb b/lib/api/concerns/packages/nuget_endpoints.rb index 31ecb529c3c..5f32f0544f4 100644 --- a/lib/api/concerns/packages/nuget_endpoints.rb +++ b/lib/api/concerns/packages/nuget_endpoints.rb @@ -64,7 +64,7 @@ module API tags %w[nuget_packages] end get 'index', format: :json, urgency: :default do - authorize_read_package!(project_or_group) + authorize_packages_access!(project_or_group, required_permission) track_package_event('cli_metadata', :nuget, **snowplow_gitlab_standard_context.merge(category: 'API::NugetPackages')) @@ -78,7 +78,7 @@ module API end namespace '/metadata/*package_name' do after_validation do - authorize_read_package!(project_or_group) + authorize_packages_access!(project_or_group, required_permission) end desc 'The NuGet Metadata Service - Package name level' do @@ -124,7 +124,7 @@ module API end namespace '/query' do after_validation do - authorize_read_package!(project_or_group) + authorize_packages_access!(project_or_group, required_permission) end desc 'The NuGet Search Service' do |