Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Group: Fix an error when update member's role
Browse files Browse the repository at this point in the history
"A group have to have at least one admin" error occured when update
a group member's role to "member" if the user who updates was the last
group admin.

The error should occur if the updated user, not the user who updates,
was the last admin.
  • Loading branch information
Yi EungJun committed May 20, 2015
1 parent 4d1e7f3 commit 942ec6a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/OrganizationApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ private static Result validateForEditMember(Form<Role> roleForm, String organiza
return okWithLocation(routes.OrganizationApp.members(organizationName).url());
}

if (organization.isLastAdmin(currentUser) && roleForm.get().id.equals(RoleType.ORG_MEMBER.roleType())) {
if (organization.isLastAdmin(User.find.byId(userId))
&& roleForm.get().id.equals(RoleType.ORG_MEMBER.roleType())) {
flash(Constants.WARNING, "organization.member.atLeastOneAdmin");
return okWithLocation(routes.OrganizationApp.members(organizationName).url());
}
Expand Down

0 comments on commit 942ec6a

Please sign in to comment.