diff options
author | Kim Alvefur <zash@zash.se> | 2022-07-20 13:05:35 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2022-07-20 13:05:35 +0200 |
commit | 5f8e4414499e33a05dc8eda7a224e69c70bdb7a2 (patch) | |
tree | 39cdc146bd632ef789b11fd2fc5a7e635cf5d77c /core | |
parent | a0f2f9ee193826cfb595bf93e237e33a926214f0 (diff) | |
download | prosody-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`
Diffstat (limited to 'core')
-rw-r--r-- | core/moduleapi.lua | 8 |
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 |