From 40270a449625f6be139e887fcf968899894d0d28 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Fri, 20 Oct 2023 14:38:27 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Rework=20ability=20logic=20for?= =?UTF-8?q?=20depositor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even though a user could not see the Add New Work or Collection button, they were still able to navigate to it via the routes. This commit will rework the ability logic for depositor so that won't happen. Ref: - https://github.com/scientist-softserv/palni-palci/issues/864 --- app/models/ability.rb | 1 - app/models/concerns/hyrax/ability/work_ability.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index 8b87b12f8..c433ad198 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -15,7 +15,6 @@ class Ability user_roles work_roles featured_collection_abilities - everyone_can_create_curation_concerns ] # If the Groups with Roles feature is disabled, allow registered users to create curation concerns # (Works, Collections, and FileSets). Otherwise, omit this ability logic as to not diff --git a/app/models/concerns/hyrax/ability/work_ability.rb b/app/models/concerns/hyrax/ability/work_ability.rb index b5ba77cfc..3545cbd31 100644 --- a/app/models/concerns/hyrax/ability/work_ability.rb +++ b/app/models/concerns/hyrax/ability/work_ability.rb @@ -15,7 +15,7 @@ def work_roles doc = permissions_doc(id) all_work_types_and_files.include?(doc.hydra_model) end - elsif work_depositor? + elsif work_depositor? || admin_set_with_deposit? can %i[create], all_work_types_and_files end end