Software /
code /
prosody
Comparison
core/usermanager.lua @ 5094:e646c849d72f
core.usermanager: Don't close sessions ourselves when deleting users. Instead, fire an event that modules can hook.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Aug 2012 01:20:13 +0200 |
parent | 5042:ce823b32225e |
child | 5129:e8253c931166 |
comparison
equal
deleted
inserted
replaced
5093:1ce9e8068dda | 5094:e646c849d72f |
---|---|
88 function create_user(username, password, host) | 88 function create_user(username, password, host) |
89 return hosts[host].users.create_user(username, password); | 89 return hosts[host].users.create_user(username, password); |
90 end | 90 end |
91 | 91 |
92 function delete_user(username, host) | 92 function delete_user(username, host) |
93 local user = hosts[host].sessions[username]; | |
94 if user and user.sessions then | |
95 for jid, session in pairs(user.sessions) do | |
96 session:close{ condition = "not-authorized", text = "Account deleted" }; | |
97 end | |
98 end | |
99 local ok, err = hosts[host].users.delete_user(username); | 93 local ok, err = hosts[host].users.delete_user(username); |
100 if not ok then return nil, err; end | 94 if not ok then return nil, err; end |
95 prosody.events.fire_event("user-deleted", { username = username, host = host }); | |
101 return storagemanager.get_driver(host):purge(username); | 96 return storagemanager.get_driver(host):purge(username); |
102 end | 97 end |
103 | 98 |
104 function get_sasl_handler(host, session) | 99 function get_sasl_handler(host, session) |
105 return hosts[host].users.get_sasl_handler(session); | 100 return hosts[host].users.get_sasl_handler(session); |