Add overload for recover_phone_account

This commit is contained in:
Johan Pascal 2019-07-08 05:49:16 +07:00
parent 3d9d252120
commit ea1afa30bf
3 changed files with 38 additions and 3 deletions

26
conf/overloads.conf Normal file
View file

@ -0,0 +1,26 @@
<?php
/* ### Overloads configuration ### */
/*
* Set the following to TRUE to overload the xmlrpc_recover_phone_account function
*
* Default value: FALSE
*/
define('XMLRPC_RECOVER_PHONE_ACCOUNT_OVERLOAD', FALSE);
/** ### Overloads implementation */
// We may need to access some of the functions provided by the server (database access at least)
// so we need to know where to find them
define("PATH_TO_INSTALLATION", "/opt/belledonne-communications/share/flexisip-account-manager");
if (XMLRPC_RECOVER_PHONE_ACCOUNT_OVERLOAD === True) {
include_once PATH_TO_INSTALLATION . '/database/database.php';
}
// args = [phone, [domain], [lang]]
// is expected to return the recovered account username or ACCOUNT_NOT_FOUND
function xmlrpc_recover_phone_account_overload($method, $args) {
}
?>

View file

@ -24,11 +24,14 @@ include_once PATH_TO_CONFIG . '/accounts.conf';
include_once PATH_TO_CONFIG . '/auth.conf';
include_once PATH_TO_CONFIG . '/db.conf';
include_once PATH_TO_CONFIG . '/emails.conf';
include_once PATH_TO_CONFIG . '/hooks.conf';
include_once PATH_TO_CONFIG . '/inapp.conf';
include_once PATH_TO_CONFIG . '/logs.conf';
include_once PATH_TO_CONFIG . '/provisioning.conf';
include_once PATH_TO_CONFIG . '/sms.conf';
include_once PATH_TO_CONFIG . '/tests.conf';
?>
// these two might include some of the scripts from the installation, so keep them last
include_once PATH_TO_CONFIG . '/hooks.conf';
include_once PATH_TO_CONFIG . '/overloads.conf';
?>

View file

@ -587,6 +587,12 @@ function xmlrpc_get_phone_number_for_account($method, $args) {
// args = [phone, [domain], [lang]]
function xmlrpc_recover_phone_account($method, $args) {
// Is this function overloaded
if (XMLRPC_RECOVER_PHONE_ACCOUNT_OVERLOAD === TRUE) {
return xmlrpc_recover_phone_account_overload($method, $args);
}
$phone = $args[0];
$domain = get_domain($args[1]);
$lang = get_lang($args[2]);
@ -788,4 +794,4 @@ function xmlrpc_accounts_register_methods($server) {
xmlrpc_server_register_method($server, 'update_email', 'xmlrpc_update_email');// args = [username, password, new email, [domain]], return OK
}
?>
?>