summaryrefslogtreecommitdiff
path: root/app/services/packages/rubygems/dependency_resolver_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/packages/rubygems/dependency_resolver_service.rb')
-rw-r--r--app/services/packages/rubygems/dependency_resolver_service.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/services/packages/rubygems/dependency_resolver_service.rb b/app/services/packages/rubygems/dependency_resolver_service.rb
index c44b26e2b92..839a7683632 100644
--- a/app/services/packages/rubygems/dependency_resolver_service.rb
+++ b/app/services/packages/rubygems/dependency_resolver_service.rb
@@ -8,7 +8,10 @@ module Packages
DEFAULT_PLATFORM = 'ruby'
def execute
- return ServiceResponse.error(message: "forbidden", http_status: :forbidden) unless Ability.allowed?(current_user, :read_package, project)
+ unless Ability.allowed?(current_user, :read_package, project&.packages_policy_subject)
+ return ServiceResponse.error(message: "forbidden", http_status: :forbidden)
+ end
+
return ServiceResponse.error(message: "#{gem_name} not found", http_status: :not_found) if packages.empty?
payload = packages.map do |package|