Group owner or admin can remove other group owners

This commit is contained in:
Dmitriy Zaporozhets 2013-09-26 10:28:43 +03:00
parent 8674e1c227
commit 02cf9aa687
2 changed files with 3 additions and 3 deletions

View file

@ -19,7 +19,7 @@ class UsersGroupsController < ApplicationController
def destroy
@users_group = @group.users_groups.find(params[:id])
@users_group.destroy unless @users_group.user == @group.owner
@users_group.destroy
respond_to do |format|
format.html { redirect_to members_group_path(@group), notice: 'User was successfully removed from group.' }

View file

@ -10,7 +10,7 @@
%span.pull-right
%strong= member.human_access
- if show_controls && user != @group.owner && user != current_user
- if show_controls && can?(current_user, :manage_group, @group) && current_user != user
= link_to '#', class: "btn-tiny btn js-toggle-button", title: 'Edit access level' do
%i.icon-edit
= 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
@ -20,4 +20,4 @@
= form_for [@group, member], remote: true do |f|
.alert.prepend-top-20
= f.select :group_access, options_for_select(UsersGroup.group_access_roles, member.group_access)
= f.submit 'Save', class: 'btn btn-save'
= f.submit 'Save', class: 'btn btn-save btn-small'