comparison mod_client_management/mod_client_management.lua @ 5594:e9af6abf2b1e

mod_client_management: Add shell command to revoke client access Could be used if an operator detects a compromised client.
author Kim Alvefur <zash@zash.se>
date Fri, 14 Jul 2023 13:25:30 +0200
parents 6d0574bfbf5d
children eae5599bc0b4
comparison
equal deleted inserted replaced
5593:6d0574bfbf5d 5594:e9af6abf2b1e
463 print(row(client)); 463 print(row(client));
464 end 464 end
465 print(string.rep("-", self.session.width)); 465 print(string.rep("-", self.session.width));
466 return true, ("%d clients"):format(#clients); 466 return true, ("%d clients"):format(#clients);
467 end 467 end
468
469 function console_env.user:revoke_client(user_jid, selector) -- luacheck: ignore 212/self
470 local username, host = jid.split(user_jid);
471 local mod = prosody.hosts[host] and prosody.hosts[host].modules.client_management;
472 if not mod then
473 return false, ("Host does not exist on this server, or does not have mod_client_management loaded");
474 end
475
476 local revoked, err = revocation_errors.coerce(mod.revoke_client_access(username, selector));
477 if not revoked then
478 return false, err.text or err;
479 end
480 return true, "Client access revoked";
481 end
468 end); 482 end);