diff options
author | Kim Alvefur <zash@zash.se> | 2012-07-09 20:21:47 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-07-09 20:21:47 +0200 |
commit | 5968142ab2b3891a2650ae003f34f19c1ed66d94 (patch) | |
tree | 72923136e84231471f8d9dc9cf82579facd4a215 /plugins | |
parent | 88f2090c5b3ace2f2f07de9735fa60307a19d010 (diff) | |
download | prosody-5968142ab2b3891a2650ae003f34f19c1ed66d94.tar.gz prosody-5968142ab2b3891a2650ae003f34f19c1ed66d94.zip |
mod_admin_telnet: Add some user management commands.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_admin_telnet.lua | 31 |
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) |