aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-07-20 13:05:35 +0200
committerKim Alvefur <zash@zash.se>2022-07-20 13:05:35 +0200
commit5f8e4414499e33a05dc8eda7a224e69c70bdb7a2 (patch)
tree39cdc146bd632ef789b11fd2fc5a7e635cf5d77c
parenta0f2f9ee193826cfb595bf93e237e33a926214f0 (diff)
downloadprosody-5f8e4414499e33a05dc8eda7a224e69c70bdb7a2.tar.gz
prosody-5f8e4414499e33a05dc8eda7a224e69c70bdb7a2.zip
moduleapi: Distribute permissions set from global modules to all hosts
Roles and permissions will always happen in the context of a host. Prevents error upon indexing since `hosts["*"] == nil`
-rw-r--r--core/moduleapi.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index fe248c20..0ec96fb6 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -604,6 +604,14 @@ end
function api:default_permission(role_name, permission)
permission = permission:gsub("^:", self.name..":");
+ if self.host == "*" then
+ for _, host in pairs(hosts) do
+ if host.authz then
+ host.authz.add_default_permission(role_name, permission);
+ end
+ end
+ return
+ end
hosts[self.host].authz.add_default_permission(role_name, permission);
end