Comparison

plugins/mod_authz_internal.lua @ 13621:eb676b6f05e3

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.
author Kim Alvefur <zash@zash.se>
date Mon, 13 Jan 2025 11:50:03 +0100
parent 13587:fdb2e0568cf8
child 13678:acb87cc2d48b
comparison
equal deleted inserted replaced
13620:7b632cd0e00d 13621:eb676b6f05e3
6 local roles = require "prosody.util.roles"; 6 local roles = require "prosody.util.roles";
7 7
8 local config_global_admin_jids = module:context("*"):get_option_set("admins", {}) / normalize; 8 local config_global_admin_jids = module:context("*"):get_option_set("admins", {}) / normalize;
9 local config_admin_jids = module:get_option_inherited_set("admins", {}) / normalize; 9 local config_admin_jids = module:get_option_inherited_set("admins", {}) / normalize;
10 local host = module.host; 10 local host = module.host;
11 local host_suffix = host:gsub("^[^%.]+%.", ""); 11 local host_suffix = module:get_option_string("parent_host", (host:gsub("^[^%.]+%.", "")));
12 12
13 local hosts = prosody.hosts; 13 local hosts = prosody.hosts;
14 local is_anon_host = module:get_option_string("authentication") == "anonymous"; 14 local is_anon_host = module:get_option_string("authentication") == "anonymous";
15 local default_user_role = module:get_option_string("default_user_role", is_anon_host and "prosody:guest" or "prosody:registered"); 15 local default_user_role = module:get_option_string("default_user_role", is_anon_host and "prosody:guest" or "prosody:registered");
16 16