mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
[SCI-6322] use correct user when creating templates, create assignment on experiments and tasks
This commit is contained in:
parent
c746d6b761
commit
b964bfd31e
2 changed files with 10 additions and 3 deletions
|
@ -190,6 +190,12 @@ class TeamImporter
|
|||
|
||||
update_smart_annotations_in_project(project)
|
||||
|
||||
# handle the permissions for newly created experiment
|
||||
user = User.find(user_id)
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_later(experiment, user)
|
||||
experiment.my_modules.each do |my_module|
|
||||
UserAssignments::GenerateUserAssignmentsJob.perform_later(my_module, user)
|
||||
end
|
||||
puts "Imported experiment: #{experiment.id}"
|
||||
return experiment
|
||||
end
|
||||
|
|
|
@ -26,8 +26,9 @@ class TemplatesService
|
|||
)
|
||||
end
|
||||
end
|
||||
owner = tmpl_project.user_projects
|
||||
.where(role: 'owner')
|
||||
owner_role_id = UserRole.find_by(name: I18n.t('user_roles.predefined.owner')).id
|
||||
owner = tmpl_project.user_assignments
|
||||
.where(user_role_id: owner_role_id)
|
||||
.order(:created_at)
|
||||
.first&.user
|
||||
return unless owner.present?
|
||||
|
|
Loading…
Reference in a new issue