Software /
code /
prosody
Changeset
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 |
parents | 12649:86e1187f6274 |
children | 12651:1ce98f27eabe |
files | core/moduleapi.lua |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
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