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

33 lines
716 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,
if: -> { action_name == 'show' && image_or_video? }
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
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
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