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

30 lines
563 B
Ruby
Raw Normal View History

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