Software /
code /
prosody
Comparison
core/usermanager.lua @ 3035:5584c928d1f7
usermanager: Fix logic for per-host admin tables (thanks Maranda)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 12 May 2010 23:06:46 +0100 |
parent | 3031:421890f3f247 |
child | 3036:0714539bcf71 |
comparison
equal
deleted
inserted
replaced
3034:b9ebd44a35f9 | 3035:5584c928d1f7 |
---|---|
82 return {["PLAIN"] = true, ["DIGEST-MD5"] = true}; -- TODO this should be taken from the config | 82 return {["PLAIN"] = true, ["DIGEST-MD5"] = true}; -- TODO this should be taken from the config |
83 end | 83 end |
84 | 84 |
85 function provider.is_admin(jid) | 85 function provider.is_admin(jid) |
86 local admins = config.get(host, "core", "admins"); | 86 local admins = config.get(host, "core", "admins"); |
87 if admins ~= config.get("*", "core", "admins") and type(admins) == "table" then | 87 if admins ~= config.get("*", "core", "admins") then |
88 jid = jid_bare(jid); | 88 if type(admins) == "table" then |
89 for _,admin in ipairs(admins) do | 89 jid = jid_bare(jid); |
90 if admin == jid then return true; end | 90 for _,admin in ipairs(admins) do |
91 if admin == jid then return true; end | |
92 end | |
93 elseif admins then | |
94 log("error", "Option 'admins' for host '%s' is not a table", host); | |
91 end | 95 end |
92 elseif admins then | |
93 log("error", "Option 'admins' for host '%s' is not a table", host); | |
94 end | 96 end |
95 return is_admin(jid); -- Test whether it's a global admin instead | 97 return is_admin(jid); -- Test whether it's a global admin instead |
96 end | 98 end |
97 return provider; | 99 return provider; |
98 end | 100 end |