diff options
Diffstat (limited to 'core/usermanager.lua')
-rw-r--r-- | core/usermanager.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/usermanager.lua b/core/usermanager.lua index fd8fe739..bee1502e 100644 --- a/core/usermanager.lua +++ b/core/usermanager.lua @@ -11,8 +11,12 @@ require "util.datamanager" local datamanager = datamanager; local log = require "util.logger".init("usermanager"); +local type = type; local error = error; +local ipairs = ipairs; local hashes = require "util.hashes"; +local jid_bare = require "util.jid".bare; +local config = require "core.configmanager"; module "usermanager" @@ -59,4 +63,15 @@ function get_supported_methods(host) return methods; end +function is_admin(jid) + local admins = config.get("*", "core", "admins") or {}; + if type(admins) == "table" then + jid = jid_bare(jid); + for _,admin in ipairs(admins) do + if admin == jid then return true; end + end + else log("debug", "Option core.admins is not a table"); end + return nil; +end + return _M; |