UNC-Libraries/hy-c

View on GitHub
app/overrides/controllers/hyrax/file_sets_controller_override.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true
# https://github.com/samvera/hyrax/blob/hyrax-v4.0.0/app/controllers/hyrax/file_sets_controller.rb

Hyrax::FileSetsController.class_eval do
  # [hyc-override] Only allow deletions by admins
  before_action :ensure_admin!, only: :destroy

  private

  def ensure_admin!
    authorize! :read, :admin_dashboard
  end
end