diff options
author | Lennart Rosam <lennart.rosam@medien-systempartner.de> | 2013-01-28 16:52:30 +0400 |
---|---|---|
committer | Lennart Rosam <lennart.rosam@medien-systempartner.de> | 2013-01-28 16:52:30 +0400 |
commit | f9a48f72d485af69b5cad6062b48ac5cfb651b74 (patch) | |
tree | 2eee256fb216cfcce51395685cab052e9d3f8fc3 /lib | |
parent | 66ebf8d83f894ed361031eb9ede5a8b829fefd36 (diff) |
Fix issue #2790
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/gitlab/bulk_add_permission.rake | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/tasks/gitlab/bulk_add_permission.rake b/lib/tasks/gitlab/bulk_add_permission.rake index 54a5c7aea76..eb1a7559dbd 100644 --- a/lib/tasks/gitlab/bulk_add_permission.rake +++ b/lib/tasks/gitlab/bulk_add_permission.rake @@ -4,21 +4,21 @@ namespace :gitlab do task :all_users_to_all_projects => :environment do |t, args| user_ids = User.where(:admin => false).pluck(:id) admin_ids = User.where(:admin => true).pluck(:id) + projects_ids = Project.pluck(:id) - Project.find_each do |project| - puts "Importing #{user_ids.size} users into #{project.code}" - UsersProject.add_users_into_projects(project, user_ids, UsersProject::DEVELOPER) - puts "Importing #{admin_ids.size} admins into #{project.code}" - UsersProject.add_users_into_projects(project, admin_ids, UsersProject::MASTER) - end + puts "Importing #{user_ids.size} users into #{projects_ids.size} projects" + UsersProject.add_users_into_projects(projects_ids, user_ids, UsersProject::DEVELOPER) + + puts "Importing #{admin_ids.size} admins into #{projects_ids.size} projects" + UsersProject.add_users_into_projects(projects_ids, admin_ids, UsersProject::MASTER) end desc "GITLAB | Add a specific user to all projects (as a developer)" task :user_to_projects, [:email] => :environment do |t, args| user = User.find_by_email args.email project_ids = Project.pluck(:id) - - UsersProject.add_users_into_projects(user, project_ids, UsersProject::DEVELOPER) + puts "Importing #{user.email} users into #{project_ids.size} projects" + UsersProject.add_users_into_projects(project_ids, Array.wrap(user.id), UsersProject::DEVELOPER) end end end
\ No newline at end of file |