Software /
code /
prosody-modules
Diff
mod_compat_roles/mod_compat_roles.lua @ 5097:d414fa8b37dc
mod_compat_roles: Fix traceback when no host roles are defined (thanks cc)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 29 Nov 2022 11:37:58 +0000 |
parent | 4983:7c77058a1ac5 |
child | 5098:817bc9873fc2 |
line wrap: on
line diff
--- a/mod_compat_roles/mod_compat_roles.lua Tue Nov 29 11:36:28 2022 +0000 +++ b/mod_compat_roles/mod_compat_roles.lua Tue Nov 29 11:37:58 2022 +0000 @@ -83,10 +83,15 @@ end function moduleapi.default_permission(self, role_name, permission) - local r = permissions[self.host][role_name]; + local p = permissions[self.host]; + if not p then + p = {}; + permissions[self.host] = p; + end + local r = p[role_name]; if not r then r = {}; - permissions[self.host][role_name] = r; + p[role_name] = r; end r[permission] = true; end