# HG changeset patch # User Kim Alvefur # Date 1341858107 -7200 # Node ID 3f7248ac1a3b4ee5623c4b2ee127858e0be3131f # Parent 0e9a5b63206a6c5d6a4b6837865ee3c738099b3d mod_admin_telnet: Add some user management commands. diff -r 0e9a5b63206a -r 3f7248ac1a3b plugins/mod_admin_telnet.lua --- a/plugins/mod_admin_telnet.lua Mon Jul 09 02:35:47 2012 +0100 +++ b/plugins/mod_admin_telnet.lua Mon Jul 09 20:21:47 2012 +0200 @@ -856,6 +856,37 @@ 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)