From b55a3eb22046bb01e54ae7ea7f116cc087e4bc88 Mon Sep 17 00:00:00 2001
From: Gyan Gupta <gyan@cottagelabs.com>
Date: Mon, 3 Feb 2025 10:15:24 +0530
Subject: [PATCH] Add accessibility for CRC 1280 button in the dashboard.

---
 hyrax/app/helpers/hyrax_helper.rb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hyrax/app/helpers/hyrax_helper.rb b/hyrax/app/helpers/hyrax_helper.rb
index 06a26fcb..a56140a5 100644
--- a/hyrax/app/helpers/hyrax_helper.rb
+++ b/hyrax/app/helpers/hyrax_helper.rb
@@ -219,8 +219,10 @@ module HyraxHelper
     template = ERB.new file_contents
     parsed_file = YAML.load(template.result(binding))
     parsed_file['collections_to_display'].each do |collection_name|
-      c = Collection.where(title: collection_name).first
-      collections_to_display.append({id: c.id, title: c.title&.first, url: "/dashboard/collections/#{c.id}"})
+      collection = Collection.where(title: collection_name).first
+      next unless can? :read, collection
+
+      collections_to_display.append({id: collection.id, title: collection.title&.first, url: "/dashboard/collections/#{collection.id}"})
       # collections_to_display.append({id: c.id, title: c.title&.first, url: dashboard_collection_path(c.id)})
     end
     collections_to_display
-- 
GitLab