changeset 4663:6e5572fc6840

mod_watch_spam_reports: Support for fetching admins from authz provider
author Matthew Wild <mwild1@gmail.com>
date Thu, 26 Aug 2021 16:52:13 +0100
parents a357c3e3bd32
children 524a9103fb45
files mod_watch_spam_reports/mod_watch_spam_reports.lua
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_watch_spam_reports/mod_watch_spam_reports.lua	Wed Aug 25 19:42:28 2021 +0200
+++ b/mod_watch_spam_reports/mod_watch_spam_reports.lua	Thu Aug 26 16:52:13 2021 +0100
@@ -1,8 +1,16 @@
 local jid = require "util.jid";
+local set = require "util.set";
 local st = require "util.stanza";
-local admins = module:get_option_inherited_set("admins");
+local usermanager = require "core.usermanager";
 local host = module.host;
 
+local admins;
+if usermanager.get_jids_with_role then
+	admins = set.new(usermanager.get_jids_with_role("prosody:admin"), host);
+else -- COMPAT w/pre-0.12
+	admins = module:get_option_inherited_set("admins");
+end
+
 module:depends("spam_reporting")
 
 module:hook("spam_reporting/spam-report", function(event)