# HG changeset patch # User Kim Alvefur # Date 1449442067 -3600 # Node ID 0ce2b400663b2e02c00863319693dbb79cbb8c29 # Parent 4688ff9d4f2b5cfee2528aefd1a723fc5f9c4986 core.usermanager: Return as soon as possible once admin status is known diff -r 4688ff9d4f2b -r 0ce2b400663b core/usermanager.lua --- a/core/usermanager.lua Sun Dec 06 02:32:29 2015 +0100 +++ b/core/usermanager.lua Sun Dec 06 23:47:47 2015 +0100 @@ -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 {