usermanager: Changed function is_admin to allow checking for host-specific admins.
authorWaqas Hussain <waqas20@gmail.com>
Wed, 21 Oct 2009 06:39:02 +0000 (11:39 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Wed, 21 Oct 2009 06:39:02 +0000 (11:39 +0500)
core/usermanager.lua

index 6c36fa29d13b8f7bfc4bf9baa6ed4df27cb673a7..04154cdb2ef5e4576f7cf33730768af2d30353ab 100644 (file)
@@ -66,8 +66,12 @@ 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