aboutsummaryrefslogtreecommitdiffstats
path: root/core/usermanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-06-09 21:24:20 +0100
committerMatthew Wild <mwild1@gmail.com>2010-06-09 21:24:20 +0100
commit10abcc0f7beaf939dd2493a611ae044b287f9f34 (patch)
tree1c3b8e75098376a8da944b64c1ce4913a6a8f6af /core/usermanager.lua
parenta0a05468a964443edb2616dbed4492c795e8bc81 (diff)
downloadprosody-10abcc0f7beaf939dd2493a611ae044b287f9f34.tar.gz
prosody-10abcc0f7beaf939dd2493a611ae044b287f9f34.zip
usermanager: Handle checking for global admins on behalf of providers
Diffstat (limited to 'core/usermanager.lua')
-rw-r--r--core/usermanager.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua
index 511ffc84..bb8cd962 100644
--- a/core/usermanager.lua
+++ b/core/usermanager.lua
@@ -90,20 +90,25 @@ function get_provider(host)
end
function is_admin(jid, host)
+ local is_admin;
if host and host ~= "*" then
- return hosts[host].users.is_admin(jid);
- else -- Test only whether this JID is a global admin
+ is_admin = hosts[host].users.is_admin(jid);
+ end
+ if not is_admin then -- Test only whether this JID is a global admin
local admins = config.get("*", "core", "admins");
if type(admins) == "table" then
jid = jid_bare(jid);
for _,admin in ipairs(admins) do
- if admin == jid then return true; end
+ if admin == jid then
+ is_admin = true;
+ break;
+ end
end
elseif admins then
log("error", "Option 'admins' for host '%s' is not a table", host);
end
- return nil;
end
+ return is_admin;
end
return _M;