diff options
Diffstat (limited to 'lib/tasks/gitlab/bulk_add_permission.rake')
-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 a903c743ea2..240b808baf3 100644 --- a/lib/tasks/gitlab/bulk_add_permission.rake +++ b/lib/tasks/gitlab/bulk_add_permission.rake @@ -6,21 +6,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) - project_ids = Project.pluck(:id) + projects = Project.all - puts "Importing #{user_ids.size} users into #{project_ids.size} projects" - ProjectMember.add_members_to_projects(project_ids, user_ids, ProjectMember::DEVELOPER) + puts "Importing #{user_ids.size} users into #{projects.size} projects" + Members::Projects::CreatorService.add_members(projects, user_ids, ProjectMember::DEVELOPER) - puts "Importing #{admin_ids.size} admins into #{project_ids.size} projects" - ProjectMember.add_members_to_projects(project_ids, admin_ids, ProjectMember::MAINTAINER) + puts "Importing #{admin_ids.size} admins into #{projects.size} projects" + Members::Projects::CreatorService.add_members(projects, admin_ids, ProjectMember::MAINTAINER) end desc "GitLab | Import | 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) - puts "Importing #{user.email} users into #{project_ids.size} projects" - ProjectMember.add_members_to_projects(project_ids, Array.wrap(user.id), ProjectMember::DEVELOPER) + projects = Project.all + puts "Importing #{user.email} users into #{projects.size} projects" + Members::Projects::CreatorService.add_members(projects, Array.wrap(user.id), ProjectMember::DEVELOPER) end desc "GitLab | Import | Add all users to all groups (admin users are added as owners)" |