# HG changeset patch # User Matthew Wild # Date 1739462079 0 # Node ID 8f43b954bdacc953ef3659ba4b150891550ef0f2 # Parent 22f1444f08f98ba1e934d7151f00478ece71f230 mod_admin_shell: Fix result handling of user addrole/delrole commands diff -r 22f1444f08f9 -r 8f43b954bdac plugins/mod_admin_shell.lua --- a/plugins/mod_admin_shell.lua Thu Feb 13 15:31:37 2025 +0000 +++ b/plugins/mod_admin_shell.lua Thu Feb 13 15:54:39 2025 +0000 @@ -1855,7 +1855,11 @@ elseif userhost ~= host then return nil, "Can't add roles outside users own host" end - return um.add_user_secondary_role(username, host, new_role); + local role, err = um.add_user_secondary_role(username, host, new_role); + if not role then + return nil, err; + end + return true, "Role added"; end describe_command [[user:delrole(jid, host, role) - Remove a secondary role from a user]] @@ -1869,7 +1873,11 @@ elseif userhost ~= host then return nil, "Can't remove roles outside users own host" end - return um.remove_user_secondary_role(username, host, role_name); + local ok, err = um.remove_user_secondary_role(username, host, role_name); + if not ok then + return nil, err; + end + return true, "Role removed"; end describe_command [[user:list(hostname, pattern) - List users on the specified host, optionally filtering with a pattern]]