Fixes a bug with group member administration

Group owners were not able to remove any users from their group if they were the only owner.
This commit is contained in:
Matt DeTullio 2014-03-09 23:28:49 -04:00
parent c3f088d261
commit 5d6d795d60
2 changed files with 2 additions and 1 deletions

View File

@ -240,6 +240,7 @@ class Ability
can_manage = group_abilities(user, group).include?(:manage_group)
if can_manage && (user != target_user)
rules << :modify
rules << :destroy
end
if !group.last_owner?(user) && (can_manage || (user == target_user))
rules << :destroy

View File

@ -74,7 +74,7 @@ Feature: Groups
When I visit group "Owned" members page
Then I should see user "John Doe" in team list
Then I should see user "Mary Jane" in team list
Then I should not see the "Remove User From Group" button for "Mary Jane"
Then I should not see the "Remove User From Group" button for "John Doe"
@javascript
Scenario: Guest should be able to remove himself from group