aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2012-07-09 20:21:47 +0200
committerKim Alvefur <zash@zash.se>2012-07-09 20:21:47 +0200
commit4f9967aa8d818dc060e48919a3adaaf9bdb3f950 (patch)
tree72923136e84231471f8d9dc9cf82579facd4a215 /plugins
parent90806a87a4b01496b4867f18c8860a52af55db9d (diff)
downloadprosody-4f9967aa8d818dc060e48919a3adaaf9bdb3f950.tar.gz
prosody-4f9967aa8d818dc060e48919a3adaaf9bdb3f950.zip
mod_admin_telnet: Add some user management commands.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_admin_telnet.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index b56f9291..208cb08b 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -856,6 +856,37 @@ function def_env.muc:room(room_jid)
return setmetatable({ room = room_obj }, console_room_mt);
end
+def_env.user = {};
+function def_env.user:create(jid, password)
+ local username, host = jid_split(jid);
+ local ok, err = um.create_user(username, password, host);
+ if ok then
+ return true, "User created";
+ else
+ return nil, "Could not create user: "..err;
+ end
+end
+
+function def_env.user:delete(jid)
+ local username, host = jid_split(jid);
+ local ok, err = um.delete_user(username, host);
+ if ok then
+ return true, "User deleted";
+ else
+ return nil, "Could not delete user: "..err;
+ end
+end
+
+function def_env.user:passwd(jid, password)
+ local username, host = jid_split(jid);
+ local ok, err = um.set_password(username, password, host);
+ if ok then
+ return true, "User created";
+ else
+ return nil, "Could not change password for user: "..err;
+ end
+end
+
-------------
function printbanner(session)