# HG changeset patch # User Kim Alvefur # Date 1658315135 -7200 # Node ID e08bf2ad67da18522bcbb4becf3ca3c420faa095 # Parent 86e1187f627485759e407adf33a3e039d50ffdaa 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` diff -r 86e1187f6274 -r e08bf2ad67da core/moduleapi.lua --- 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