Changeset

3219:fd06023cbdcc

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
author Matthew Wild <mwild1@gmail.com>
date Wed, 09 Jun 2010 21:25:59 +0100
parents 3218:032b81731f0f
children 3220:b3772f9bc359
files plugins/mod_auth_internal.lua plugins/mod_auth_internal_hashed.lua
diffstat 2 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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