2018-09-23 15:44:14 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-06 06:36:11 -05:00
|
|
|
class Groups::UploadsController < Groups::ApplicationController
|
|
|
|
include UploadsActions
|
2018-06-12 11:54:37 -04:00
|
|
|
include WorkhorseRequest
|
2017-12-06 06:36:11 -05:00
|
|
|
|
2022-02-24 22:16:18 -05:00
|
|
|
skip_before_action :group, if: -> { action_name == 'show' && embeddable? }
|
2017-12-06 06:36:11 -05:00
|
|
|
|
2018-06-12 11:54:37 -04:00
|
|
|
before_action :authorize_upload_file!, only: [:create, :authorize]
|
|
|
|
before_action :verify_workhorse_api!, only: [:authorize]
|
2017-12-06 06:36:11 -05:00
|
|
|
|
2020-10-06 08:08:38 -04:00
|
|
|
feature_category :subgroups
|
2022-04-22 14:09:22 -04:00
|
|
|
urgency :low, [:show]
|
2020-10-06 08:08:38 -04:00
|
|
|
|
2017-12-06 06:36:11 -05:00
|
|
|
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
|