diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-03-08 03:46:44 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-03-08 03:46:44 +0500 |
commit | 612012dcb6f66e108bc82f9237597c21aeeb28b4 (patch) | |
tree | 5ff72ed4413a7c0a5723531fc0f5545fc57a2610 | |
parent | 4f4129d52df7ae37f4e65c3dfae7d08728d3e741 (diff) | |
download | prosody-612012dcb6f66e108bc82f9237597c21aeeb28b4.tar.gz prosody-612012dcb6f66e108bc82f9237597c21aeeb28b4.zip |
usermanager: Added is_admin(jid)
-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; |