gitlab-org--gitlab-foss/app/controllers/groups/uploads_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
743 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-12-06 11:36:11 +00:00
class Groups::UploadsController < Groups::ApplicationController
include UploadsActions
include WorkhorseRequest
2017-12-06 11:36:11 +00:00
skip_before_action :group, if: -> { action_name == 'show' && embeddable? }
2017-12-06 11:36:11 +00:00
before_action :authorize_upload_file!, only: [:create, :authorize]
before_action :verify_workhorse_api!, only: [:authorize]
2017-12-06 11:36:11 +00:00
feature_category :subgroups
urgency :low, [:show]
2017-12-06 11:36:11 +00:00
private
2018-01-29 17:57:34 +00:00
def upload_model_class
Group
2017-12-06 11:36:11 +00:00
end
2018-01-29 17:57:34 +00:00
def uploader_class
NamespaceFileUploader
2017-12-06 11:36:11 +00:00
end
2018-01-29 17:57:34 +00:00
def find_model
return @group if @group
2017-12-06 11:36:11 +00:00
2018-01-29 17:57:34 +00:00
group_id = params[:group_id]
Group.find_by_full_path(group_id)
2017-12-06 11:36:11 +00:00
end
2018-01-29 17:57:34 +00:00
def authorize_upload_file!
render_404 unless can?(current_user, :upload_file, group)
end
2017-12-06 11:36:11 +00:00
end