mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 05:37:39 +03:00
mod_authz_internal: Fix return values of secondary role management methods
usermanager expects (role, err) and (ok, err)
This commit is contained in:
parent
3cdaf29bf8
commit
dc810fea2d
1 changed files with 8 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue