Mercurial > prosody-hg
comparison core/usermanager.lua @ 2030:d9382a16af5b
usermanager: Changed function is_admin to allow checking for host-specific admins.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 21 Oct 2009 11:39:02 +0500 |
| parents | 812ae3be7bed |
| children | e82ceb5bbe49 |
comparison
equal
deleted
inserted
replaced
| 2029:d2363643a5c0 | 2030:d9382a16af5b |
|---|---|
| 64 | 64 |
| 65 function get_supported_methods(host) | 65 function get_supported_methods(host) |
| 66 return {["PLAIN"] = true, ["DIGEST-MD5"] = true}; -- TODO this should be taken from the config | 66 return {["PLAIN"] = true, ["DIGEST-MD5"] = true}; -- TODO this should be taken from the config |
| 67 end | 67 end |
| 68 | 68 |
| 69 function is_admin(jid) | 69 function is_admin(jid, host) |
| 70 local admins = config.get("*", "core", "admins"); | 70 host = host or "*"; |
| 71 local admins = config.get(host, "core", "admins"); | |
| 72 if host ~= "*" and admins == config.get("*", "core", "admins") then | |
| 73 return nil; | |
| 74 end | |
| 71 if type(admins) == "table" then | 75 if type(admins) == "table" then |
| 72 jid = jid_bare(jid); | 76 jid = jid_bare(jid); |
| 73 for _,admin in ipairs(admins) do | 77 for _,admin in ipairs(admins) do |
| 74 if admin == jid then return true; end | 78 if admin == jid then return true; end |
| 75 end | 79 end |
