UNC-Libraries/hy-c

View on GitHub
app/controllers/hyrax/hyc_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true
module Hyrax
  class HycController < ApplicationController
    # Adds Hyrax behaviors to the controller.
    include Hyrax::WorksControllerBehavior
    include Hyrax::BreadcrumbsForWorks

    private

    def ensure_admin!
      authorize! :read, :admin_dashboard
    end

    def ensure_admin_set!
      return redirect_to root_path, alert: 'No Admin Sets have been created.' if AdminSet.all.count.zero?
    end
  end
end