access-default: do not crash if the rules section is not defined in the config

This commit is contained in:
George Kiagiadakis
2023-11-15 15:41:40 +02:00
parent ab44996ce9
commit 460e714a10

View File

@@ -44,10 +44,12 @@ end
function getPermissions (properties)
local section = Conf.get_section ("access.rules")
local matched, mprops = JsonUtils.match_rules_update_properties (
section, properties)
if (matched > 0 and mprops["default_permissions"]) then
return mprops["default_permissions"], mprops["access"]
if section then
local matched, mprops = JsonUtils.match_rules_update_properties (
section, properties)
if (matched > 0 and mprops["default_permissions"]) then
return mprops["default_permissions"], mprops["access"]
end
end
return nil, nil