Commit 22ec4637 authored by Seif Attar's avatar Seif Attar

rake task to add all users to all projects

parent ed2b53cd
desc "Add all users to all projects, system administratos are added as masters"
task :add_users_to_project_teams => :environment do |t, args|
users = User.find_all_by_admin(false, :select => 'id').map(&:id)
admins = User.find_all_by_admin(true, :select => 'id').map(&:id)
users.each do |user|
puts "#{user}"
end
Project.all.each do |project|
puts "Importing #{users.length} users into #{project.path}"
UsersProject.bulk_import(project, users, UsersProject::DEVELOPER)
puts "Importing #{admins.length} admins into #{project.path}"
UsersProject.bulk_import(project, admins, UsersProject::MASTER)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment