diff --git a/app/controllers/users_groups_controller.rb b/app/controllers/users_groups_controller.rb index 9181f1683aed52a3e09f8b9859b1f7f0b9b301a7..c30034d7d0e57f29e0de32ce19d2d7b1feff4fc8 100644 --- a/app/controllers/users_groups_controller.rb +++ b/app/controllers/users_groups_controller.rb @@ -18,7 +18,7 @@ class UsersGroupsController < ApplicationController def destroy @users_group = @group.users_groups.find(params[:id]) - @users_group.destroy + @users_group.destroy unless @users_group.user == @group.owner respond_to do |format| format.html { redirect_to people_group_path(@group), notice: 'User was successfully removed from group.' } diff --git a/app/views/users_groups/_users_group.html.haml b/app/views/users_groups/_users_group.html.haml index c6dca5f3425c9496da2ce13cfda3eab07443fa3d..3a1e32dd79def846b018fad50e3dc8356013ecc3 100644 --- a/app/views/users_groups/_users_group.html.haml +++ b/app/views/users_groups/_users_group.html.haml @@ -13,6 +13,6 @@ - else = member.human_access - - if show_controls && user != current_user + - if show_controls && user != current_user && user != @group.owner = link_to group_users_group_path(@group, member), confirm: remove_user_from_group_message(@group, user), method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do %i.icon-minus.icon-white diff --git a/lib/tasks/migrate/migrate_groups.rake b/lib/tasks/migrate/migrate_groups.rake new file mode 100644 index 0000000000000000000000000000000000000000..153172dc90a73e8de761ec81e7dbe552430e7c65 --- /dev/null +++ b/lib/tasks/migrate/migrate_groups.rake @@ -0,0 +1,16 @@ +desc "GITLAB | Migrate Gropus to match v6.0" +task migrate_groups: :environment do + puts "This will add group owners to group membership" + ask_to_continue + + Group.find_each(batch_size: 20) do |group| + begin + group.send :add_owner + print '.' + rescue => ex + puts ex.message + print 'F' + end + end +end +