mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-25 01:03:18 +08:00
Merge pull request #4845 from aignatov-bio/ai-sci-7758-fix-user-designation-on-creation
Fix user designation on task creation [SCI-7758]
This commit is contained in:
commit
5cbaf83067
3 changed files with 7 additions and 3 deletions
|
@ -47,9 +47,9 @@ class MyModulesController < ApplicationController
|
|||
if my_module_tags_params[:tag_ids].present?
|
||||
@my_module.tags << @experiment.project.tags.where(id: JSON.parse(my_module_tags_params[:tag_ids]))
|
||||
end
|
||||
if my_module_designated_users_params[:user_ids].present? && can_manage_my_module_designated_users?(@my_module)
|
||||
if my_module_designated_users_params[:user_ids].present? && can_designate_users_to_new_task?(@experiment)
|
||||
@my_module.designated_users << @experiment.users.where(id: my_module_designated_users_params[:user_ids])
|
||||
elsif !can_manage_my_module_designated_users?(@my_module)
|
||||
elsif !can_designate_users_to_new_task?(@experiment)
|
||||
@my_module.designated_users << current_user
|
||||
end
|
||||
@my_module.save!
|
||||
|
|
|
@ -84,6 +84,10 @@ Canaid::Permissions.register_for(Experiment) do
|
|||
can :move_experiment do |user, experiment|
|
||||
experiment.permission_granted?(user, ExperimentPermissions::MANAGE)
|
||||
end
|
||||
|
||||
can :designate_users_to_new_task do |user, experiment|
|
||||
experiment.permission_granted?(user, MyModulePermissions::DESIGNATED_USERS_MANAGE)
|
||||
end
|
||||
end
|
||||
|
||||
Canaid::Permissions.register_for(Protocol) do
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% if can_manage_my_module_designated_users?(@my_module)%>
|
||||
<% if can_designate_users_to_new_task?(@experiment) %>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
||||
<label><%= t('experiments.canvas.new_my_module_modal.assigned_users') %></label>
|
||||
|
|
Loading…
Reference in a new issue