Skip to content
Snippets Groups Projects
Commit f0db42e0 authored by Gyan Gupta's avatar Gyan Gupta
Browse files

fixes ability for review submission page

parent 0bd11db0
No related branches found
No related tags found
2 merge requests!385Fixes ability for review submission page,!346Draft: Hyrax 5 - Upgrade hyrax to v5
Pipeline #20712 failed
......@@ -62,4 +62,19 @@ class Ability
def can_export_works?
can_create_any_work?
end
def can_review_submissions?
# Short-circuit logic for admins, who should have the ability
# to review submissions whether or not they are explicitly
# granted the approving role in any workflows
return true if admin?
# Are there any workflows where this user has the "approving" responsibility
approving_roles = Sipity::Role.where(name: ['approving_crc_manager', 'approving_group_manager', 'approving_publication_manager'])
return false unless approving_roles
Hyrax::Workflow::PermissionQuery.scope_processing_agents_for(user: current_user).any? do |agent|
agent.workflow_responsibilities.joins(:workflow_role).where('sipity_workflow_roles.role_id' => approving_roles.pluck(:id)).any?
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment