Diff

core/usermanager.lua @ 6988:329d5fb8a9d3

Merge 0.10->trunk
author Matthew Wild <mwild1@gmail.com>
date Thu, 10 Dec 2015 18:58:30 +0000
parent 6979:0ce2b400663b
child 7177:1295e14614f4
line wrap: on
line diff
--- a/core/usermanager.lua	Tue Dec 08 23:15:42 2015 +0000
+++ b/core/usermanager.lua	Thu Dec 10 18:58:30 2015 +0000
@@ -111,7 +111,6 @@
 	if host and not hosts[host] then return false; end
 	if type(jid) ~= "string" then return false; end
 
-	local is_admin;
 	jid = jid_bare(jid);
 	host = host or "*";
 
@@ -122,8 +121,7 @@
 		if type(host_admins) == "table" then
 			for _,admin in ipairs(host_admins) do
 				if jid_prep(admin) == jid then
-					is_admin = true;
-					break;
+					return true;
 				end
 			end
 		elseif host_admins then
@@ -131,12 +129,11 @@
 		end
 	end
 
-	if not is_admin and global_admins then
+	if global_admins then
 		if type(global_admins) == "table" then
 			for _,admin in ipairs(global_admins) do
 				if jid_prep(admin) == jid then
-					is_admin = true;
-					break;
+					return true;
 				end
 			end
 		elseif global_admins then
@@ -145,10 +142,10 @@
 	end
 
 	-- Still not an admin, check with auth provider
-	if not is_admin and host ~= "*" and hosts[host].users and hosts[host].users.is_admin then
-		is_admin = hosts[host].users.is_admin(jid);
+	if host ~= "*" and hosts[host].users and hosts[host].users.is_admin then
+		return hosts[host].users.is_admin(jid);
 	end
-	return is_admin or false;
+	return false;
 end
 
 return {