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

Use bareJIDs for admins. JM-1492

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10890 b35dd754-fafc-0310-a699-88a17e54d16e
parent 838b4ca7
...@@ -72,21 +72,21 @@ public class AdminManager { ...@@ -72,21 +72,21 @@ public class AdminManager {
// Detect when a new admin provider class is set // Detect when a new admin provider class is set
PropertyEventListener propListener = new PropertyEventListener() { PropertyEventListener propListener = new PropertyEventListener() {
public void propertySet(String property, Map params) { public void propertySet(String property, Map<String, Object> params) {
if ("provider.admin.className".equals(property)) { if ("provider.admin.className".equals(property)) {
initProvider(); initProvider();
} }
} }
public void propertyDeleted(String property, Map params) { public void propertyDeleted(String property, Map<String, Object> params) {
//Ignore //Ignore
} }
public void xmlPropertySet(String property, Map params) { public void xmlPropertySet(String property, Map<String, Object> params) {
//Ignore //Ignore
} }
public void xmlPropertyDeleted(String property, Map params) { public void xmlPropertyDeleted(String property, Map<String, Object> params) {
//Ignore //Ignore
} }
}; };
...@@ -172,12 +172,13 @@ public class AdminManager { ...@@ -172,12 +172,13 @@ public class AdminManager {
if (adminList == null) { if (adminList == null) {
loadAdminList(); loadAdminList();
} }
if (adminList.contains(jid)) { JID bareJID = new JID(jid.toBareJID());
if (adminList.contains(bareJID)) {
// Already have them. // Already have them.
return; return;
} }
// Add new admin to cache. // Add new admin to cache.
adminList.add(jid); adminList.add(bareJID);
// Store updated list of admins with provider. // Store updated list of admins with provider.
provider.setAdmins(adminList); provider.setAdmins(adminList);
} }
...@@ -211,11 +212,13 @@ public class AdminManager { ...@@ -211,11 +212,13 @@ public class AdminManager {
if (adminList == null) { if (adminList == null) {
loadAdminList(); loadAdminList();
} }
if (!adminList.contains(jid)) {
JID bareJID = new JID(jid.toBareJID());
if (!adminList.contains(bareJID)) {
return; return;
} }
// Remove user from admin list cache. // Remove user from admin list cache.
adminList.remove(jid); adminList.remove(bareJID);
// Store updated list of admins with provider. // Store updated list of admins with provider.
provider.setAdmins(adminList); provider.setAdmins(adminList);
} }
...@@ -252,7 +255,8 @@ public class AdminManager { ...@@ -252,7 +255,8 @@ public class AdminManager {
if (allowAdminIfEmpty && adminList.isEmpty()) { if (allowAdminIfEmpty && adminList.isEmpty()) {
return "admin".equals(jid.getNode()); return "admin".equals(jid.getNode());
} }
return adminList.contains(jid); JID bareJID = new JID(jid.toBareJID());
return adminList.contains(bareJID);
} }
/** /**
...@@ -302,8 +306,13 @@ public class AdminManager { ...@@ -302,8 +306,13 @@ public class AdminManager {
else { else {
adminList.clear(); adminList.clear();
} }
adminList.addAll(jids);
provider.setAdmins(jids);
}
List<JID> admins = new ArrayList<JID>();
for (JID jid : jids)
{
admins.add(new JID(jid.toBareJID()));
}
adminList.addAll(admins);
provider.setAdmins(admins);
}
} }
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