25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Switch access rule delete_old_users with protect_old_users (#1772)

This commit is contained in:
Badlop 2017-06-09 19:18:47 +02:00
parent 8c1568ff93
commit 63b6e0d381

View File

@ -174,9 +174,9 @@ get_commands_spec() ->
desc = "Delete users that didn't log in last days, or that never logged", desc = "Delete users that didn't log in last days, or that never logged",
longdesc = "To protect admin accounts, configure this for example:\n" longdesc = "To protect admin accounts, configure this for example:\n"
"access_rules:\n" "access_rules:\n"
" delete_old_users:\n" " protect_old_users:\n"
" - deny: admin\n" " - allow: admin\n"
" - allow: all\n", " - deny: all\n",
module = ?MODULE, function = delete_old_users, module = ?MODULE, function = delete_old_users,
args = [{days, integer}], args = [{days, integer}],
args_example = [30], args_example = [30],
@ -817,7 +817,7 @@ delete_old_users(Days, Users) ->
{removed, length(Users_removed), Users_removed}. {removed, length(Users_removed), Users_removed}.
delete_or_not(LUser, LServer, TimeStamp_oldest) -> delete_or_not(LUser, LServer, TimeStamp_oldest) ->
allow = acl:match_rule(LServer, delete_old_users, jid:make(LUser, LServer)), deny = acl:match_rule(LServer, protect_old_users, jid:make(LUser, LServer)),
[] = ejabberd_sm:get_user_resources(LUser, LServer), [] = ejabberd_sm:get_user_resources(LUser, LServer),
case mod_last:get_last_info(LUser, LServer) of case mod_last:get_last_info(LUser, LServer) of
{ok, TimeStamp, _Status} -> {ok, TimeStamp, _Status} ->