debian-mirror-gitlab/app/controllers/projects/uploads_controller.rb

39 lines
826 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2015-04-26 12:48:37 +05:30
class Projects::UploadsController < Projects::ApplicationController
2017-08-17 22:00:37 +05:30
include UploadsActions
2018-11-08 19:23:39 +05:30
include WorkhorseRequest
2015-04-26 12:48:37 +05:30
2018-03-17 18:26:18 +05:30
# These will kick you out if you don't have access.
2017-08-17 22:00:37 +05:30
skip_before_action :project, :repository,
2022-04-04 11:22:00 +05:30
if: -> { bypass_auth_checks_on_uploads? }
2015-04-26 12:48:37 +05:30
2018-11-08 19:23:39 +05:30
before_action :authorize_upload_file!, only: [:create, :authorize]
before_action :verify_workhorse_api!, only: [:authorize]
2015-04-26 12:48:37 +05:30
2022-06-21 17:19:12 +05:30
feature_category :not_owned # rubocop:todo Gitlab/AvoidFeatureCategoryNotOwned
2021-01-03 14:25:43 +05:30
2016-06-02 11:05:42 +05:30
private
2018-03-17 18:26:18 +05:30
def upload_model_class
Project
2015-04-26 12:48:37 +05:30
end
2017-08-17 22:00:37 +05:30
def uploader_class
FileUploader
end
2022-07-16 23:28:13 +05:30
def target_project
model
end
2018-03-17 18:26:18 +05:30
def find_model
return @project if @project
namespace = params[:namespace_id]
id = params[:project_id]
Project.find_by_full_path("#{namespace}/#{id}")
end
2015-04-26 12:48:37 +05:30
end