Software /
code /
prosody
Diff
core/moduleapi.lua @ 12650:e08bf2ad67da
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`
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 20 Jul 2022 13:05:35 +0200 |
parent | 12645:a741183eec97 |
child | 12651:1ce98f27eabe |
line wrap: on
line diff
--- a/core/moduleapi.lua Wed Jul 20 10:52:17 2022 +0100 +++ b/core/moduleapi.lua Wed Jul 20 13:05:35 2022 +0200 @@ -604,6 +604,14 @@ 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