Commit 50f047ca authored by Patricio Cano's avatar Patricio Cano

Move the `objects` method to `LfsHelper` so that it is also available to `LfsStorageController`

It is needed for the `lfs_check_access!` callback when the repository size limit is enabled (EE only).
parent a3fd8521
...@@ -31,10 +31,6 @@ class Projects::LfsApiController < Projects::GitHttpClientController ...@@ -31,10 +31,6 @@ class Projects::LfsApiController < Projects::GitHttpClientController
private private
def objects
@objects ||= (params[:objects] || []).to_a
end
def existing_oids def existing_oids
@existing_oids ||= begin @existing_oids ||= begin
storage_project.lfs_objects.where(oid: objects.map { |o| o['oid'].to_s }).pluck(:oid) storage_project.lfs_objects.where(oid: objects.map { |o| o['oid'].to_s }).pluck(:oid)
......
...@@ -30,6 +30,10 @@ module LfsHelper ...@@ -30,6 +30,10 @@ module LfsHelper
ci? || lfs_deploy_token? || user_can_download_code? || build_can_download_code? ci? || lfs_deploy_token? || user_can_download_code? || build_can_download_code?
end end
def objects
@objects ||= (params[:objects] || []).to_a
end
def user_can_download_code? def user_can_download_code?
has_authentication_ability?(:download_code) && can?(user, :download_code, project) has_authentication_ability?(:download_code) && can?(user, :download_code, project)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment