diff --git a/app/services/team_importer.rb b/app/services/team_importer.rb index 7bc0a14f6..c62152091 100644 --- a/app/services/team_importer.rb +++ b/app/services/team_importer.rb @@ -189,7 +189,13 @@ class TeamImporter end 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 diff --git a/app/services/templates_service.rb b/app/services/templates_service.rb index 78a4d20fe..8bdb18caf 100644 --- a/app/services/templates_service.rb +++ b/app/services/templates_service.rb @@ -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?