diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-22 17:25:49 +0000 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-22 17:25:49 +0000 |
| commit | 8cd882355edf7b88011ad7fca13ccba5f948001b (patch) | |
| tree | f55e11d8d2c8d5a3f4b728a392194579f93a85f9 /lib/tasks | |
| parent | b3c53efc42ff242e948393ddf7fb3ea6fb340480 (diff) | |
| parent | 648557048226ba98c514531135e96df9c34bdda7 (diff) | |
| download | gitlab-ce-8cd882355edf7b88011ad7fca13ccba5f948001b.tar.gz | |
Merge branch '7-4-pre' into 'master'
7.4 development
Development branch during `master` code freeze for 7.3
See merge request !1096
Diffstat (limited to 'lib/tasks')
| -rw-r--r-- | lib/tasks/gitlab/bulk_add_permission.rake | 12 | ||||
| -rw-r--r-- | lib/tasks/gitlab/check.rake | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/tasks/gitlab/bulk_add_permission.rake b/lib/tasks/gitlab/bulk_add_permission.rake index 0e1a3d071e9..3d8c171dfa3 100644 --- a/lib/tasks/gitlab/bulk_add_permission.rake +++ b/lib/tasks/gitlab/bulk_add_permission.rake @@ -7,10 +7,10 @@ namespace :gitlab do projects_ids = Project.pluck(:id) puts "Importing #{user_ids.size} users into #{projects_ids.size} projects" - UsersProject.add_users_into_projects(projects_ids, user_ids, UsersProject::DEVELOPER) + ProjectMember.add_users_into_projects(projects_ids, user_ids, ProjectMember::DEVELOPER) puts "Importing #{admin_ids.size} admins into #{projects_ids.size} projects" - UsersProject.add_users_into_projects(projects_ids, admin_ids, UsersProject::MASTER) + ProjectMember.add_users_into_projects(projects_ids, admin_ids, ProjectMember::MASTER) end desc "GITLAB | Add a specific user to all projects (as a developer)" @@ -18,7 +18,7 @@ namespace :gitlab do user = User.find_by(email: args.email) project_ids = Project.pluck(:id) puts "Importing #{user.email} users into #{project_ids.size} projects" - UsersProject.add_users_into_projects(project_ids, Array.wrap(user.id), UsersProject::DEVELOPER) + ProjectMember.add_users_into_projects(project_ids, Array.wrap(user.id), ProjectMember::DEVELOPER) end desc "GITLAB | Add all users to all groups (admin users are added as owners)" @@ -30,8 +30,8 @@ namespace :gitlab do puts "Importing #{user_ids.size} users into #{groups.size} groups" puts "Importing #{admin_ids.size} admins into #{groups.size} groups" groups.each do |group| - group.add_users(user_ids, UsersGroup::DEVELOPER) - group.add_users(admin_ids, UsersGroup::OWNER) + group.add_users(user_ids, GroupMember::DEVELOPER) + group.add_users(admin_ids, GroupMember::OWNER) end end @@ -41,7 +41,7 @@ namespace :gitlab do groups = Group.all puts "Importing #{user.email} users into #{groups.size} groups" groups.each do |group| - group.add_users(Array.wrap(user.id), UsersGroup::DEVELOPER) + group.add_users(Array.wrap(user.id), GroupMember::DEVELOPER) end end end diff --git a/lib/tasks/gitlab/check.rake b/lib/tasks/gitlab/check.rake index 248b567d007..9ec368254ac 100644 --- a/lib/tasks/gitlab/check.rake +++ b/lib/tasks/gitlab/check.rake @@ -17,7 +17,7 @@ namespace :gitlab do check_database_config_exists check_database_is_not_sqlite check_migrations_are_up - check_orphaned_users_groups + check_orphaned_group_members check_gitlab_config_exists check_gitlab_config_not_outdated check_log_writable @@ -194,13 +194,13 @@ namespace :gitlab do end end - def check_orphaned_users_groups - print "Database contains orphaned UsersGroups? ... " - if UsersGroup.where("user_id not in (select id from users)").count > 0 + def check_orphaned_group_members + print "Database contains orphaned GroupMembers? ... " + if GroupMember.where("user_id not in (select id from users)").count > 0 puts "yes".red try_fixing_it( "You can delete the orphaned records using something along the lines of:", - sudo_gitlab("bundle exec rails runner -e production 'UsersGroup.where(\"user_id NOT IN (SELECT id FROM users)\").delete_all'") + sudo_gitlab("bundle exec rails runner -e production 'GroupMember.where(\"user_id NOT IN (SELECT id FROM users)\").delete_all'") ) else puts "no".green |
