mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
usermanager, mod_auth_internal_hashed: Support metadata when disabling a user
This allows us to store a time, actor, comment and/or reason why an account was disabled, which seems a generally useful thing to support.
This commit is contained in:
parent
b97c4ffc16
commit
253b2fba90
2 changed files with 5 additions and 4 deletions
|
@ -163,12 +163,12 @@ local function enable_user(username, host)
|
||||||
return ret, err;
|
return ret, err;
|
||||||
end
|
end
|
||||||
|
|
||||||
local function disable_user(username, host)
|
local function disable_user(username, host, meta)
|
||||||
local method = hosts[host].users.disable;
|
local method = hosts[host].users.disable;
|
||||||
if not method then return nil, "method not supported"; end
|
if not method then return nil, "method not supported"; end
|
||||||
local ret, err = method(username);
|
local ret, err = method(username, meta);
|
||||||
if ret then
|
if ret then
|
||||||
prosody.events.fire_event("user-disabled", { username = username, host = host });
|
prosody.events.fire_event("user-disabled", { username = username, host = host, meta = meta });
|
||||||
end
|
end
|
||||||
return ret, err;
|
return ret, err;
|
||||||
end
|
end
|
||||||
|
|
|
@ -126,9 +126,10 @@ function provider.enable(username)
|
||||||
return accounts:set(username, account);
|
return accounts:set(username, account);
|
||||||
end
|
end
|
||||||
|
|
||||||
function provider.disable(username)
|
function provider.disable(username, meta)
|
||||||
local account = accounts:get(username);
|
local account = accounts:get(username);
|
||||||
account.disabled = true;
|
account.disabled = true;
|
||||||
|
account.disabled_meta = meta;
|
||||||
account.updated = os.time();
|
account.updated = os.time();
|
||||||
return accounts:set(username, account);
|
return accounts:set(username, account);
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue