mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 10:08:05 +00:00
Fix #141 Add a new hook system for the Account Service
This commit is contained in:
parent
146a5731e8
commit
a01cd8d922
4 changed files with 43 additions and 7 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
v1.5
|
v1.5
|
||||||
----
|
----
|
||||||
|
- Fix #141 Add a new hook system for the Account Service
|
||||||
- Fix #138 Add a dictionary attached to the accounts
|
- Fix #138 Add a dictionary attached to the accounts
|
||||||
- Fix #137 Migrate the icons from Material Icons to Material Symbols
|
- Fix #137 Migrate the icons from Material Icons to Material Symbols
|
||||||
- Fix #135 Refactor the password algorithms code
|
- Fix #135 Refactor the password algorithms code
|
||||||
|
|
|
||||||
17
README.md
17
README.md
|
|
@ -142,6 +142,7 @@ If you are planning to send emails using your account manager:
|
||||||
|
|
||||||
For the web panel, a general documentation is available under the `/documentation` page.
|
For the web panel, a general documentation is available under the `/documentation` page.
|
||||||
For the REST API, the `/api` page contains all the required documentation to authenticate and request the API.
|
For the REST API, the `/api` page contains all the required documentation to authenticate and request the API.
|
||||||
|
FlexiAPI is also providing endpoints to provision Liblinphone powered devices. You can find more documentation about it on the `/provisioning/documentation` documentation page.
|
||||||
|
|
||||||
## Console commands
|
## Console commands
|
||||||
|
|
||||||
|
|
@ -191,15 +192,19 @@ This command will set the admin role to any available Flexisip account. You need
|
||||||
|
|
||||||
Once one account is declared as administrator, you can directly configure the other ones using the web panel.
|
Once one account is declared as administrator, you can directly configure the other ones using the web panel.
|
||||||
|
|
||||||
|
### Seed liblinphone test accounts
|
||||||
|
|
||||||
|
You can also seed the tables with test accounts for the liblinphone test suite with the following command (check LiblinphoneTesterAccoutSeeder for the JSON syntax):
|
||||||
|
|
||||||
|
php artisan accounts:seed /path/to/accounts.json
|
||||||
|
|
||||||
## Custom email templaces
|
## Custom email templaces
|
||||||
|
|
||||||
Some email templates can be customized.
|
Some email templates can be customized.
|
||||||
|
|
||||||
To do so, copy and rename the existing `*_custom.blade.php.example` files into `*custom.blade.php` and adapt the content of the email (HTML and text versions), those files will then replace the default ones.
|
To do so, copy and rename the existing `*_custom.blade.php.example` files into `*custom.blade.php` and adapt the content of the email (HTML and text versions), those files will then replace the default ones.
|
||||||
|
|
||||||
## Provisioning
|
## Hooks
|
||||||
|
|
||||||
FlexiAPI is providing endpoints to provision Liblinphone powered devices. You can find more documentation about it on the `/api#provisioning` documentation page.
|
|
||||||
|
|
||||||
### Provisioning hooks
|
### Provisioning hooks
|
||||||
|
|
||||||
|
|
@ -208,11 +213,9 @@ The XML returned by the provisioning endpoint can be completed using hooks.
|
||||||
To do so, copy and rename the `provisioning_hooks.php.example` file into `provisioning_hooks.php` in the configuration directory and complete the functions in the file.
|
To do so, copy and rename the `provisioning_hooks.php.example` file into `provisioning_hooks.php` in the configuration directory and complete the functions in the file.
|
||||||
The functions already contains example codes to show you how the XML can be enhanced or completed.
|
The functions already contains example codes to show you how the XML can be enhanced or completed.
|
||||||
|
|
||||||
### Seed liblinphone test accounts
|
### Account Service hooks
|
||||||
|
|
||||||
You can also seed the tables with test accounts for the liblinphone test suite with the following command (check LiblinphoneTesterAccoutSeeder for the JSON syntax):
|
The internal Account Service is also providing hooks. Rename and complete the following file to enable and use them: `account_service_hooks.php.example`.
|
||||||
|
|
||||||
php artisan accounts:seed /path/to/accounts.json
|
|
||||||
|
|
||||||
## Sending SIP messages from the API
|
## Sending SIP messages from the API
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,12 @@ class AccountService
|
||||||
{
|
{
|
||||||
public function __construct(public bool $api = true)
|
public function __construct(public bool $api = true)
|
||||||
{
|
{
|
||||||
|
// Load the hooks if they exists
|
||||||
|
$accountServiceHooks = config_path('account_service_hooks.php');
|
||||||
|
|
||||||
|
if (file_exists($accountServiceHooks)) {
|
||||||
|
require_once($accountServiceHooks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,6 +96,10 @@ class AccountService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function_exists('accountServiceAccountCreatedHook')) {
|
||||||
|
accountServiceAccountCreatedHook($request, $account);
|
||||||
|
}
|
||||||
|
|
||||||
return Account::withoutGlobalScopes()->find($account->id);
|
return Account::withoutGlobalScopes()->find($account->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
22
flexiapi/config/account_service_hooks.php.example
Normal file
22
flexiapi/config/account_service_hooks.php.example
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Account;
|
||||||
|
use App\Password;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file contains hooks functions used by the Account Service
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Run specific code once a fresh account is created
|
||||||
|
* @param Request $request
|
||||||
|
* @param Account $account
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function accountServiceAccountCreatedHook(Request $request, Account $account)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue