usermanager: Changed function is_admin to allow checking for host-specific admins.

Wed, 21 Oct 2009 11:39:02 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Wed, 21 Oct 2009 11:39:02 +0500
changeset 2030
d9382a16af5b
parent 2029
d2363643a5c0
child 2031
e82ceb5bbe49

usermanager: Changed function is_admin to allow checking for host-specific admins.

core/usermanager.lua file | annotate | diff | comparison | revisions
--- a/core/usermanager.lua	Wed Oct 21 11:29:43 2009 +0500
+++ b/core/usermanager.lua	Wed Oct 21 11:39:02 2009 +0500
@@ -66,8 +66,12 @@
 	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

mercurial