mod_authz_internal: Fix return values of secondary role management methods

usermanager expects (role, err) and (ok, err)
This commit is contained in:
Matthew Wild 2025-02-13 15:30:23 +00:00
parent 3cdaf29bf8
commit dc810fea2d

View file

@ -180,14 +180,19 @@ function set_user_role(user, role_name)
end
function add_user_secondary_role(user, role_name)
if not role_registry[role_name] then
local role = role_registry[role_name];
if not role then
return error("Cannot assign default user an unknown role: "..tostring(role_name));
end
role_map_store:set(user, role_name, true);
local ok, err = role_map_store:set(user, role_name, true);
if not ok then
return nil, err;
end
return role;
end
function remove_user_secondary_role(user, role_name)
role_map_store:set(user, role_name, nil);
return role_map_store:set(user, role_name, nil);
end
function get_user_secondary_roles(user)