Commit 9de23248 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

You should not be able to remove a Group owner

parent 1dd66061
...@@ -18,7 +18,7 @@ class UsersGroupsController < ApplicationController ...@@ -18,7 +18,7 @@ class UsersGroupsController < ApplicationController
def destroy def destroy
@users_group = @group.users_groups.find(params[:id]) @users_group = @group.users_groups.find(params[:id])
@users_group.destroy @users_group.destroy unless @users_group.user == @group.owner
respond_to do |format| respond_to do |format|
format.html { redirect_to people_group_path(@group), notice: 'User was successfully removed from group.' } format.html { redirect_to people_group_path(@group), notice: 'User was successfully removed from group.' }
......
...@@ -13,6 +13,6 @@ ...@@ -13,6 +13,6 @@
- else - else
= member.human_access = 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 = 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 %i.icon-minus.icon-white
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
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