From f21c794a95122ee3612b9225a4e1587e7e7cbc44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Zrim=C5=A1ek?= Date: Fri, 9 Feb 2018 19:20:06 +0100 Subject: [PATCH] Fixed permission error when accessing samples page. --- app/permissions/experiment.rb | 4 ++-- app/views/shared/_samples.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/permissions/experiment.rb b/app/permissions/experiment.rb index 4cf808cc0..7f06eac77 100644 --- a/app/permissions/experiment.rb +++ b/app/permissions/experiment.rb @@ -72,9 +72,9 @@ Canaid::Permissions.register_for(MyModule) do end # module: assign/unassign sample + # NOTE: Use 'module_page? &&' before calling this permission! can :assign_sample_to_module do |user, my_module| - module_page? && - user.is_technician_or_higher_of_project?(my_module.experiment.project) + user.is_technician_or_higher_of_project?(my_module.experiment.project) end # module: complete/uncomplete diff --git a/app/views/shared/_samples.html.erb b/app/views/shared/_samples.html.erb index 4f1edf62e..c2888eae8 100644 --- a/app/views/shared/_samples.html.erb +++ b/app/views/shared/_samples.html.erb @@ -109,7 +109,7 @@ <% end %> - <% if can_assign_sample_to_module?(@my_module) %> + <% if module_page? && can_assign_sample_to_module?(@my_module) %>