mod_authz_internal: Make host considered the parent configurable

This bestows the role specified by the 'host_user_role' setting onto
users of that host. For simplicity, only a single host can be specified.

Making it configurable allows for setups where VirtualHost and related
Components may be siblings instead of having a subdomain relationship.

For setups with many VirtualHosts sharing a single Component, the
'server_user_role' setting is more appropriate. Even more complicated
setups would have to resort to mod_firewall or similar.
This commit is contained in:
Kim Alvefur 2025-01-13 11:50:03 +01:00
parent dc80c46504
commit 879cb1672f

View file

@ -8,7 +8,7 @@ local roles = require "prosody.util.roles";
local config_global_admin_jids = module:context("*"):get_option_set("admins", {}) / normalize;
local config_admin_jids = module:get_option_inherited_set("admins", {}) / normalize;
local host = module.host;
local host_suffix = host:gsub("^[^%.]+%.", "");
local host_suffix = module:get_option_string("parent_host", (host:gsub("^[^%.]+%.", "")));
local hosts = prosody.hosts;
local is_anon_host = module:get_option_string("authentication") == "anonymous";