diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-10-21 12:02:30 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-10-21 12:02:30 +0500 |
commit | fe9ea9641ba0ac94afe943d47b44cb3305356a95 (patch) | |
tree | 539c0318c44f84cc9808840daff3cde0264e81fa /core/usermanager.lua | |
parent | 1d89d7c92ca542ea063033148d25c25409f31a80 (diff) | |
parent | 27298d7e5b5d1c40e378f7169e1c96293791c021 (diff) | |
download | prosody-fe9ea9641ba0ac94afe943d47b44cb3305356a95.tar.gz prosody-fe9ea9641ba0ac94afe943d47b44cb3305356a95.zip |
Merged with trunk.
Diffstat (limited to 'core/usermanager.lua')
-rw-r--r-- | core/usermanager.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua index 6c36fa29..925ac774 100644 --- a/core/usermanager.lua +++ b/core/usermanager.lua @@ -6,10 +6,7 @@ -- COPYING file in the source package for more information. -- - - -require "util.datamanager" -local datamanager = datamanager; +local datamanager = require "util.datamanager"; local log = require "util.logger".init("usermanager"); local type = type; local error = error; @@ -66,14 +63,18 @@ function get_supported_methods(host) return {["PLAIN"] = true, ["DIGEST-MD5"] = true}; -- TODO this should be taken from the config end -function is_admin(jid) - local admins = config.get("*", "core", "admins"); +function is_admin(jid, host) + host = host or "*"; + local admins = config.get(host, "core", "admins"); + if host ~= "*" and admins == config.get("*", "core", "admins") then + return nil; + end if type(admins) == "table" then jid = jid_bare(jid); for _,admin in ipairs(admins) do if admin == jid then return true; end end - else log("debug", "Option core.admins is not a table"); end + elseif admins then log("warn", "Option 'admins' for host '%s' is not a table", host); end return nil; end |