aboutsummaryrefslogtreecommitdiffstats
path: root/core/usermanager.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-12-06 23:47:47 +0100
committerKim Alvefur <zash@zash.se>2015-12-06 23:47:47 +0100
commit3eea501911122bf8d4b41bfa774f42fc8645b9a5 (patch)
treeb49f4e8499b96c88cbd0ad1b52e07b5ca7867f71 /core/usermanager.lua
parentdcda8abb47990e330a9e844d37ff6a956b995f14 (diff)
downloadprosody-3eea501911122bf8d4b41bfa774f42fc8645b9a5.tar.gz
prosody-3eea501911122bf8d4b41bfa774f42fc8645b9a5.zip
core.usermanager: Return as soon as possible once admin status is known
Diffstat (limited to 'core/usermanager.lua')
-rw-r--r--core/usermanager.lua15
1 files changed, 6 insertions, 9 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua
index d874447d..0d8d7f91 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -111,7 +111,6 @@ local function is_admin(jid, host)
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 @@ local function is_admin(jid, host)
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 @@ local function is_admin(jid, host)
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 @@ local function is_admin(jid, host)
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 {