Software /
code /
prosody
Comparison
plugins/mod_auth_internal_hashed.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 | 3216:d4d0519cd0c1 |
child | 3243:dc7131d4e189 |
comparison
equal
deleted
inserted
replaced
3218:032b81731f0f | 3219:fd06023cbdcc |
---|---|
157 }; | 157 }; |
158 return new_sasl(realm, testpass_authentication_profile); | 158 return new_sasl(realm, testpass_authentication_profile); |
159 end | 159 end |
160 | 160 |
161 function provider.is_admin(jid) | 161 function provider.is_admin(jid) |
162 local admins = config.get(host, "core", "admins"); | 162 local admins = module:get_option_array("admins"); |
163 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then | 163 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then |
164 jid = jid_bare(jid); | 164 jid = jid_bare(jid); |
165 for _,admin in ipairs(admins) do | 165 for _,admin in ipairs(admins) do |
166 if admin == jid then return true; end | 166 if admin == jid then return true; end |
167 end | 167 end |
168 elseif admins then | |
169 log("error", "Option 'admins' for host '%s' is not a table", host); | |
170 end | 168 end |
171 return is_admin(jid); -- Test whether it's a global admin instead | |
172 end | 169 end |
173 return provider; | 170 return provider; |
174 end | 171 end |
175 | 172 |
176 module:add_item("auth-provider", new_hashpass_provider(module.host)); | 173 module:add_item("auth-provider", new_hashpass_provider(module.host)); |