Commit 5d6d795d60050c2c5db95501b6de38e458fd41b6
1 parent
c3f088d2
Exists in
spb-stable
and in
3 other branches
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.
Showing
2 changed files
with
2 additions
and
1 deletions
Show diff stats
app/models/ability.rb
@@ -240,6 +240,7 @@ class Ability | @@ -240,6 +240,7 @@ class Ability | ||
240 | can_manage = group_abilities(user, group).include?(:manage_group) | 240 | can_manage = group_abilities(user, group).include?(:manage_group) |
241 | if can_manage && (user != target_user) | 241 | if can_manage && (user != target_user) |
242 | rules << :modify | 242 | rules << :modify |
243 | + rules << :destroy | ||
243 | end | 244 | end |
244 | if !group.last_owner?(user) && (can_manage || (user == target_user)) | 245 | if !group.last_owner?(user) && (can_manage || (user == target_user)) |
245 | rules << :destroy | 246 | rules << :destroy |
features/group.feature
@@ -74,7 +74,7 @@ Feature: Groups | @@ -74,7 +74,7 @@ Feature: Groups | ||
74 | When I visit group "Owned" members page | 74 | When I visit group "Owned" members page |
75 | Then I should see user "John Doe" in team list | 75 | Then I should see user "John Doe" in team list |
76 | Then I should see user "Mary Jane" in team list | 76 | Then I should see user "Mary Jane" in team list |
77 | - Then I should not see the "Remove User From Group" button for "Mary Jane" | 77 | + Then I should not see the "Remove User From Group" button for "John Doe" |
78 | 78 | ||
79 | @javascript | 79 | @javascript |
80 | Scenario: Guest should be able to remove himself from group | 80 | Scenario: Guest should be able to remove himself from group |