mod_auth_internal{,_hashed}: Update is_admin to only report the admin status of the current host (ignores global admin rights), fixes global access traceback

Wed, 09 Jun 2010 21:25:59 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 09 Jun 2010 21:25:59 +0100
changeset 3219
fd06023cbdcc
parent 3218
032b81731f0f
child 3220
b3772f9bc359

mod_auth_internal{,_hashed}: Update is_admin to only report the admin status of the current host (ignores global admin rights), fixes global access traceback

plugins/mod_auth_internal.lua file | annotate | diff | comparison | revisions
plugins/mod_auth_internal_hashed.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_auth_internal.lua	Wed Jun 09 21:24:20 2010 +0100
+++ b/plugins/mod_auth_internal.lua	Wed Jun 09 21:25:59 2010 +0100
@@ -95,16 +95,13 @@
 	end
 
 	function provider.is_admin(jid)
-		local admins = config.get(host, "core", "admins");
+		local admins = module:get_option_array("admins");
 		if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then
 			jid = jid_bare(jid);
 			for _,admin in ipairs(admins) do
 				if admin == jid then return true; end
 			end
-		elseif admins then
-			log("error", "Option 'admins' for host '%s' is not a table", host);
 		end
-		return is_admin(jid); -- Test whether it's a global admin instead
 	end
 	return provider;
 end
--- a/plugins/mod_auth_internal_hashed.lua	Wed Jun 09 21:24:20 2010 +0100
+++ b/plugins/mod_auth_internal_hashed.lua	Wed Jun 09 21:25:59 2010 +0100
@@ -159,16 +159,13 @@
 	end
 
 	function provider.is_admin(jid)
-		local admins = config.get(host, "core", "admins");
+		local admins = module:get_option_array("admins");
 		if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then
 			jid = jid_bare(jid);
 			for _,admin in ipairs(admins) do
 				if admin == jid then return true; end
 			end
-		elseif admins then
-			log("error", "Option 'admins' for host '%s' is not a table", host);
 		end
-		return is_admin(jid); -- Test whether it's a global admin instead
 	end
 	return provider;
 end

mercurial