Software /
code /
prosody
Changeset
6979:0ce2b400663b
core.usermanager: Return as soon as possible once admin status is known
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 06 Dec 2015 23:47:47 +0100 |
parents | 6976:4688ff9d4f2b |
children | 6980:daaa52b3f45f |
files | core/usermanager.lua |
diffstat | 1 files changed, 6 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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 {