Comparison

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
comparison
equal deleted inserted replaced
5096:16db0a6e868c 5097:d414fa8b37dc
81 return permit; 81 return permit;
82 end 82 end
83 end 83 end
84 84
85 function moduleapi.default_permission(self, role_name, permission) 85 function moduleapi.default_permission(self, role_name, permission)
86 local r = permissions[self.host][role_name]; 86 local p = permissions[self.host];
87 if not p then
88 p = {};
89 permissions[self.host] = p;
90 end
91 local r = p[role_name];
87 if not r then 92 if not r then
88 r = {}; 93 r = {};
89 permissions[self.host][role_name] = r; 94 p[role_name] = r;
90 end 95 end
91 r[permission] = true; 96 r[permission] = true;
92 end 97 end
93 98
94 function moduleapi.default_permissions(self, role_name, permission_list) 99 function moduleapi.default_permissions(self, role_name, permission_list)