Commit 9c11e0d8 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Do not allow owners, admins or outcasts to have duplicated JIDs. JM-828

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5360 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3c22e359
...@@ -999,6 +999,11 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -999,6 +999,11 @@ public class MUCRoomImpl implements MUCRoom {
if (MUCRole.Affiliation.owner != sendRole.getAffiliation()) { if (MUCRole.Affiliation.owner != sendRole.getAffiliation()) {
throw new ForbiddenException(); throw new ForbiddenException();
} }
// Check if user is already an owner
if (owners.contains(bareJID)) {
// Do nothing
return Collections.emptyList();
}
owners.add(bareJID); owners.add(bareJID);
// Remove the user from other affiliation lists // Remove the user from other affiliation lists
if (removeAdmin(bareJID)) { if (removeAdmin(bareJID)) {
...@@ -1042,6 +1047,11 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -1042,6 +1047,11 @@ public class MUCRoomImpl implements MUCRoom {
if (owners.contains(bareJID) && owners.size() == 1) { if (owners.contains(bareJID) && owners.size() == 1) {
throw new ConflictException(); throw new ConflictException();
} }
// Check if user is already an admin
if (admins.contains(bareJID)) {
// Do nothing
return Collections.emptyList();
}
admins.add(bareJID); admins.add(bareJID);
// Remove the user from other affiliation lists // Remove the user from other affiliation lists
if (removeOwner(bareJID)) { if (removeOwner(bareJID)) {
...@@ -1151,6 +1161,11 @@ public class MUCRoomImpl implements MUCRoom { ...@@ -1151,6 +1161,11 @@ public class MUCRoomImpl implements MUCRoom {
if (owners.contains(bareJID) && owners.size() == 1) { if (owners.contains(bareJID) && owners.size() == 1) {
throw new ConflictException(); throw new ConflictException();
} }
// Check if user is already an outcast
if (outcasts.contains(bareJID)) {
// Do nothing
return Collections.emptyList();
}
// Update the presence with the new affiliation and inform all occupants // Update the presence with the new affiliation and inform all occupants
JID actorJID = null; JID actorJID = null;
// actorJID will be null if the room itself (ie. via admin console) made the request // actorJID will be null if the room itself (ie. via admin console) made the request
......
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