Software /
code /
prosody-modules
Changeset
4805:683d1ad16b56
mod_admin_blocklist: Update admin check for new 0.12 role API
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 04 Dec 2021 16:17:55 +0100 |
parents | 4804:a7c0c70e64b6 |
children | 4806:80f871bedcdf |
files | mod_admin_blocklist/mod_admin_blocklist.lua |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_admin_blocklist/mod_admin_blocklist.lua Thu Dec 02 23:43:11 2021 +0100 +++ b/mod_admin_blocklist/mod_admin_blocklist.lua Sat Dec 04 16:17:55 2021 +0100 @@ -2,7 +2,7 @@ -- -- If a local admin has blocked a domain, don't allow s2s to that domain -- --- Copyright (C) 2015 Kim Alvefur +-- Copyright (C) 2015-2021 Kim Alvefur -- -- This file is MIT/X11 licensed. -- @@ -12,7 +12,16 @@ local st = require"util.stanza"; local jid_split = require"util.jid".split; -local admins = module:get_option_inherited_set("admins", {}) / +local usermanager = require "core.usermanager"; + +local admins; +if usermanager.get_jids_with_role then + local set = require "util.set"; + admins = set.new(usermanager.get_jids_with_role("prosody:admin"), module.host); +else -- COMPAT w/pre-0.12 + admins = module:get_option_inherited_set("admins", {}); +end +admins = admins / function (admin) -- Filter out non-local admins local user, host = jid_split(admin); if host == module.host then return user; end