Comparison

plugins/mod_auth_internal.lua @ 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
parent 3187:a475fbce1990
child 3272:5ad2710d7bb8
comparison
equal deleted inserted replaced
3218:032b81731f0f 3219:fd06023cbdcc
93 }; 93 };
94 return new_sasl(realm, getpass_authentication_profile); 94 return new_sasl(realm, getpass_authentication_profile);
95 end 95 end
96 96
97 function provider.is_admin(jid) 97 function provider.is_admin(jid)
98 local admins = config.get(host, "core", "admins"); 98 local admins = module:get_option_array("admins");
99 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then 99 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then
100 jid = jid_bare(jid); 100 jid = jid_bare(jid);
101 for _,admin in ipairs(admins) do 101 for _,admin in ipairs(admins) do
102 if admin == jid then return true; end 102 if admin == jid then return true; end
103 end 103 end
104 elseif admins then
105 log("error", "Option 'admins' for host '%s' is not a table", host);
106 end 104 end
107 return is_admin(jid); -- Test whether it's a global admin instead
108 end 105 end
109 return provider; 106 return provider;
110 end 107 end
111 108
112 module:add_item("auth-provider", new_default_provider(module.host)); 109 module:add_item("auth-provider", new_default_provider(module.host));