aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2025-02-13 15:54:39 +0000
committerMatthew Wild <mwild1@gmail.com>2025-02-13 15:54:39 +0000
commitb07c1436e7a89cb74d2341253ff27249818743f2 (patch)
treecb2382f06ac649926d8b0344d4c7d5fed1cb9068
parentccacf5acb30b7908098945688f1a1227663278d5 (diff)
downloadprosody-b07c1436e7a89cb74d2341253ff27249818743f2.tar.gz
prosody-b07c1436e7a89cb74d2341253ff27249818743f2.zip
mod_admin_shell: Fix result handling of user addrole/delrole commands
-rw-r--r--plugins/mod_admin_shell.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua
index fe231dca..87d2ab4b 100644
--- a/plugins/mod_admin_shell.lua
+++ b/plugins/mod_admin_shell.lua
@@ -1855,7 +1855,11 @@ function def_env.user:addrole(jid, host, new_role)
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 @@ function def_env.user:delrole(jid, host, role_name)
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]]