Split APP_EVERYONE_IS_ADMIN in two and introduce APP_ADMINS_MANAGE_MULTI_DOMAINS to allow admins to manage accounts accross the domains

Update the admins panels to allow domains to be edited
Update the tests
Update the dependencies
Complete the documentation
This commit is contained in:
Timothée Jaussoin 2022-01-04 16:15:43 +01:00
parent 630b75cfc2
commit 585cc2f02c
15 changed files with 165 additions and 138 deletions

View file

@ -6,7 +6,10 @@ APP_URL=http://localhost
APP_SIP_DOMAIN=sip.example.com
APP_FLEXISIP_PROXY_PID=/var/run/flexisip-proxy.pid
APP_FLEXISIP_PUSHER_PATH=
APP_EVERYONE_IS_ADMIN=false
# Risky toggles
APP_EVERYONE_IS_ADMIN=false # Allow any accounts to request the API as an administrator
APP_ADMINS_MANAGE_MULTI_DOMAINS=false # Allow admins to handle all the accounts in the database
# SIP server parameters
ACCOUNT_PROXY_REGISTRAR_ADDRESS=sip.example.com # Proxy registrar address, can be different than the SIP domain

View file

@ -22,6 +22,7 @@ namespace App;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Auth;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Str;
@ -49,9 +50,13 @@ class Account extends Authenticatable
*/
protected static function booted()
{
static::addGlobalScope('domain', function (Builder $builder) {
$builder->where('domain', config('app.sip_domain'));
});
$user = Auth::user();
if (!$user || !$user->admin || !config('app.admins_manage_multi_domains')) {
static::addGlobalScope('domain', function (Builder $builder) {
$builder->where('domain', config('app.sip_domain'));
});
}
}
public function scopeSip($query, string $sip)

View file

@ -68,7 +68,9 @@ class AccountController extends Controller
$account->username = $request->get('username');
$account->email = $request->get('email');
$account->display_name = $request->get('display_name');
$account->domain = config('app.sip_domain');
$account->domain = $request->has('domain') && config('app.admins_manage_multi_domains')
? $request->get('domain')
: config('app.sip_domain');
$account->ip_address = $request->ip();
$account->creation_time = Carbon::now();
$account->user_agent = config('app.name');

View file

@ -54,12 +54,12 @@ class AccountController extends Controller
'required',
new NoUppercase,
Rule::unique('accounts', 'username')->where(function ($query) use ($request) {
$query->where('domain', $request->has('domain') && config('app.everyone_is_admin')
$query->where('domain', $request->has('domain') && config('app.admins_manage_multi_domains')
? $request->get('domain')
: config('app.sip_domain'));
}),
Rule::unique('accounts_tombstones', 'username')->where(function ($query) use ($request) {
$query->where('domain', $request->has('domain') && config('app.everyone_is_admin')
$query->where('domain', $request->has('domain') && config('app.admins_manage_multi_domains')
? $request->get('domain')
: config('app.sip_domain'));
}),
@ -85,7 +85,7 @@ class AccountController extends Controller
$account->username = $request->get('username');
$account->email = $request->get('email');
$account->activated = false;
$account->domain = $request->has('domain') && config('app.everyone_is_admin')
$account->domain = $request->has('domain') && config('app.admins_manage_multi_domains')
? $request->get('domain')
: config('app.sip_domain');
$account->ip_address = $request->ip();

View file

@ -96,7 +96,7 @@ class AccountController extends Controller
'username' => [
'required',
Rule::unique('accounts', 'username')->where(function ($query) use ($request) {
$query->where('domain', $request->has('domain') && config('app.everyone_is_admin')
$query->where('domain', $request->has('domain') && config('app.admins_manage_multi_domains')
? $request->get('domain')
: config('app.sip_domain')
);
@ -128,7 +128,7 @@ class AccountController extends Controller
: false;
$account->ip_address = $request->ip();
$account->creation_time = Carbon::now();
$account->domain = $request->has('domain') && config('app.everyone_is_admin')
$account->domain = $request->has('domain') && config('app.admins_manage_multi_domains')
? $request->get('domain')
: config('app.sip_domain');
$account->user_agent = $request->header('User-Agent') ?? config('app.name');

View file

@ -24,6 +24,7 @@ class CreateAccountRequest extends FormRequest
}),
'filled',
],
'domain' => config('app.admins_manage_multi_domains') ? 'required' : '',
'password' => 'required|min:3',
'email' => 'nullable|email',
'phone' => [

View file

@ -24,6 +24,7 @@ class UpdateAccountRequest extends FormRequest
})->ignore($this->route('id'), 'id'),
'filled',
],
'domain' => config('app.admins_manage_multi_domains') ? 'required' : '',
'email' => 'nullable|email',
'password_sha256' => 'nullable|min:3',
'phone' => [

226
flexiapi/composer.lock generated
View file

@ -1459,16 +1459,16 @@
},
{
"name": "laravel/framework",
"version": "v8.75.0",
"version": "v8.77.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "0bb91d3176357da232da69762a64b0e0a0988637"
"reference": "994dbac5c6da856c77c81a411cff5b7d31519ca8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/0bb91d3176357da232da69762a64b0e0a0988637",
"reference": "0bb91d3176357da232da69762a64b0e0a0988637",
"url": "https://api.github.com/repos/laravel/framework/zipball/994dbac5c6da856c77c81a411cff5b7d31519ca8",
"reference": "994dbac5c6da856c77c81a411cff5b7d31519ca8",
"shasum": ""
},
"require": {
@ -1486,7 +1486,7 @@
"opis/closure": "^3.6",
"php": "^7.3|^8.0",
"psr/container": "^1.0",
"psr/log": "^1.0 || ^2.0",
"psr/log": "^1.0|^2.0",
"psr/simple-cache": "^1.0",
"ramsey/uuid": "^4.2.2",
"swiftmailer/swiftmailer": "^6.3",
@ -1627,7 +1627,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2021-12-07T14:55:46+00:00"
"time": "2021-12-21T20:22:29+00:00"
},
{
"name": "laravel/serializable-closure",
@ -1931,16 +1931,16 @@
},
{
"name": "league/flysystem",
"version": "1.1.8",
"version": "1.1.9",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "c995bb0c23c58c9813d081f9523c9b7bb496698e"
"reference": "094defdb4a7001845300334e7c1ee2335925ef99"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/c995bb0c23c58c9813d081f9523c9b7bb496698e",
"reference": "c995bb0c23c58c9813d081f9523c9b7bb496698e",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/094defdb4a7001845300334e7c1ee2335925ef99",
"reference": "094defdb4a7001845300334e7c1ee2335925ef99",
"shasum": ""
},
"require": {
@ -2013,7 +2013,7 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/1.1.8"
"source": "https://github.com/thephpleague/flysystem/tree/1.1.9"
},
"funding": [
{
@ -2021,7 +2021,7 @@
"type": "other"
}
],
"time": "2021-11-28T21:50:23+00:00"
"time": "2021-12-09T09:40:50+00:00"
},
{
"name": "league/mime-type-detection",
@ -3242,23 +3242,23 @@
},
{
"name": "symfony/console",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "ec3661faca1d110d6c307e124b44f99ac54179e3"
"reference": "a2c6b7ced2eb7799a35375fb9022519282b5405e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/ec3661faca1d110d6c307e124b44f99ac54179e3",
"reference": "ec3661faca1d110d6c307e124b44f99ac54179e3",
"url": "https://api.github.com/repos/symfony/console/zipball/a2c6b7ced2eb7799a35375fb9022519282b5405e",
"reference": "a2c6b7ced2eb7799a35375fb9022519282b5405e",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php73": "^1.8",
"symfony/polyfill-php73": "^1.9",
"symfony/polyfill-php80": "^1.16",
"symfony/service-contracts": "^1.1|^2|^3",
"symfony/string": "^5.1|^6.0"
@ -3321,7 +3321,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v5.4.0"
"source": "https://github.com/symfony/console/tree/v5.4.2"
},
"funding": [
{
@ -3337,20 +3337,20 @@
"type": "tidelift"
}
],
"time": "2021-11-29T15:30:56+00:00"
"time": "2021-12-20T16:11:12+00:00"
},
{
"name": "symfony/css-selector",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "44b933f98bb4b5220d10bed9ce5662f8c2d13dcc"
"reference": "cfcbee910e159df402603502fe387e8b677c22fd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/44b933f98bb4b5220d10bed9ce5662f8c2d13dcc",
"reference": "44b933f98bb4b5220d10bed9ce5662f8c2d13dcc",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/cfcbee910e159df402603502fe387e8b677c22fd",
"reference": "cfcbee910e159df402603502fe387e8b677c22fd",
"shasum": ""
},
"require": {
@ -3387,7 +3387,7 @@
"description": "Converts CSS selectors to XPath expressions",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/css-selector/tree/v5.4.0"
"source": "https://github.com/symfony/css-selector/tree/v5.4.2"
},
"funding": [
{
@ -3403,7 +3403,7 @@
"type": "tidelift"
}
],
"time": "2021-09-09T08:06:01+00:00"
"time": "2021-12-16T21:58:21+00:00"
},
{
"name": "symfony/deprecation-contracts",
@ -3474,16 +3474,16 @@
},
{
"name": "symfony/error-handler",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/error-handler.git",
"reference": "8433fa3145ac78df88b87a4a539118e950828126"
"reference": "e0c0dd0f9d4120a20158fc9aec2367d07d38bc56"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/8433fa3145ac78df88b87a4a539118e950828126",
"reference": "8433fa3145ac78df88b87a4a539118e950828126",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/e0c0dd0f9d4120a20158fc9aec2367d07d38bc56",
"reference": "e0c0dd0f9d4120a20158fc9aec2367d07d38bc56",
"shasum": ""
},
"require": {
@ -3525,7 +3525,7 @@
"description": "Provides tools to manage errors and ease debugging PHP code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/error-handler/tree/v5.4.0"
"source": "https://github.com/symfony/error-handler/tree/v5.4.2"
},
"funding": [
{
@ -3541,7 +3541,7 @@
"type": "tidelift"
}
],
"time": "2021-11-29T15:30:56+00:00"
"time": "2021-12-19T20:02:00+00:00"
},
{
"name": "symfony/event-dispatcher",
@ -3709,16 +3709,16 @@
},
{
"name": "symfony/finder",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590"
"reference": "e77046c252be48c48a40816187ed527703c8f76c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/d2f29dac98e96a98be467627bd49c2efb1bc2590",
"reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590",
"url": "https://api.github.com/repos/symfony/finder/zipball/e77046c252be48c48a40816187ed527703c8f76c",
"reference": "e77046c252be48c48a40816187ed527703c8f76c",
"shasum": ""
},
"require": {
@ -3752,7 +3752,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v5.4.0"
"source": "https://github.com/symfony/finder/tree/v5.4.2"
},
"funding": [
{
@ -3768,20 +3768,20 @@
"type": "tidelift"
}
],
"time": "2021-11-28T15:25:38+00:00"
"time": "2021-12-15T11:06:13+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "5ef86ac7927d2de08dc1e26eb91325f9ccbe6309"
"reference": "ce952af52877eaf3eab5d0c08cc0ea865ed37313"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/5ef86ac7927d2de08dc1e26eb91325f9ccbe6309",
"reference": "5ef86ac7927d2de08dc1e26eb91325f9ccbe6309",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/ce952af52877eaf3eab5d0c08cc0ea865ed37313",
"reference": "ce952af52877eaf3eab5d0c08cc0ea865ed37313",
"shasum": ""
},
"require": {
@ -3825,7 +3825,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v5.4.0"
"source": "https://github.com/symfony/http-foundation/tree/v5.4.2"
},
"funding": [
{
@ -3841,20 +3841,20 @@
"type": "tidelift"
}
],
"time": "2021-11-28T15:25:38+00:00"
"time": "2021-12-28T17:15:56+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "e012f16688bcb151e965473a70d8ebaa8b1d15ea"
"reference": "35b7e9868953e0d1df84320bb063543369e43ef5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/e012f16688bcb151e965473a70d8ebaa8b1d15ea",
"reference": "e012f16688bcb151e965473a70d8ebaa8b1d15ea",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/35b7e9868953e0d1df84320bb063543369e43ef5",
"reference": "35b7e9868953e0d1df84320bb063543369e43ef5",
"shasum": ""
},
"require": {
@ -3937,7 +3937,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v5.4.0"
"source": "https://github.com/symfony/http-kernel/tree/v5.4.2"
},
"funding": [
{
@ -3953,20 +3953,20 @@
"type": "tidelift"
}
],
"time": "2021-11-29T16:56:53+00:00"
"time": "2021-12-29T13:20:26+00:00"
},
{
"name": "symfony/mime",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "d4365000217b67c01acff407573906ff91bcfb34"
"reference": "1bfd938cf9562822c05c4d00e8f92134d3c8e42d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/d4365000217b67c01acff407573906ff91bcfb34",
"reference": "d4365000217b67c01acff407573906ff91bcfb34",
"url": "https://api.github.com/repos/symfony/mime/zipball/1bfd938cf9562822c05c4d00e8f92134d3c8e42d",
"reference": "1bfd938cf9562822c05c4d00e8f92134d3c8e42d",
"shasum": ""
},
"require": {
@ -4020,7 +4020,7 @@
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v5.4.0"
"source": "https://github.com/symfony/mime/tree/v5.4.2"
},
"funding": [
{
@ -4036,7 +4036,7 @@
"type": "tidelift"
}
],
"time": "2021-11-23T10:19:22+00:00"
"time": "2021-12-28T17:15:56+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -4848,16 +4848,16 @@
},
{
"name": "symfony/process",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "5be20b3830f726e019162b26223110c8f47cf274"
"reference": "2b3ba8722c4aaf3e88011be5e7f48710088fb5e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274",
"reference": "5be20b3830f726e019162b26223110c8f47cf274",
"url": "https://api.github.com/repos/symfony/process/zipball/2b3ba8722c4aaf3e88011be5e7f48710088fb5e4",
"reference": "2b3ba8722c4aaf3e88011be5e7f48710088fb5e4",
"shasum": ""
},
"require": {
@ -4890,7 +4890,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v5.4.0"
"source": "https://github.com/symfony/process/tree/v5.4.2"
},
"funding": [
{
@ -4906,7 +4906,7 @@
"type": "tidelift"
}
],
"time": "2021-11-28T15:25:38+00:00"
"time": "2021-12-27T21:01:00+00:00"
},
{
"name": "symfony/routing",
@ -5083,16 +5083,16 @@
},
{
"name": "symfony/string",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d"
"reference": "e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d",
"reference": "9ffaaba53c61ba75a3c7a3a779051d1e9ec4fd2d",
"url": "https://api.github.com/repos/symfony/string/zipball/e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d",
"reference": "e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d",
"shasum": ""
},
"require": {
@ -5149,7 +5149,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v5.4.0"
"source": "https://github.com/symfony/string/tree/v5.4.2"
},
"funding": [
{
@ -5165,20 +5165,20 @@
"type": "tidelift"
}
],
"time": "2021-11-24T10:02:00+00:00"
"time": "2021-12-16T21:52:00+00:00"
},
{
"name": "symfony/translation",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "6fe32b10e912a518805bc9eafc2a87145773cf13"
"reference": "ff8bb2107b6a549dc3c5dd9c498dcc82c9c098ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/6fe32b10e912a518805bc9eafc2a87145773cf13",
"reference": "6fe32b10e912a518805bc9eafc2a87145773cf13",
"url": "https://api.github.com/repos/symfony/translation/zipball/ff8bb2107b6a549dc3c5dd9c498dcc82c9c098ca",
"reference": "ff8bb2107b6a549dc3c5dd9c498dcc82c9c098ca",
"shasum": ""
},
"require": {
@ -5246,7 +5246,7 @@
"description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/translation/tree/v5.4.0"
"source": "https://github.com/symfony/translation/tree/v5.4.2"
},
"funding": [
{
@ -5262,7 +5262,7 @@
"type": "tidelift"
}
],
"time": "2021-11-29T15:30:56+00:00"
"time": "2021-12-25T19:45:36+00:00"
},
{
"name": "symfony/translation-contracts",
@ -5344,16 +5344,16 @@
},
{
"name": "symfony/var-dumper",
"version": "v5.4.0",
"version": "v5.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "89ab66eaef230c9cd1992de2e9a1b26652b127b9"
"reference": "1b56c32c3679002b3a42384a580e16e2600f41c1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/89ab66eaef230c9cd1992de2e9a1b26652b127b9",
"reference": "89ab66eaef230c9cd1992de2e9a1b26652b127b9",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/1b56c32c3679002b3a42384a580e16e2600f41c1",
"reference": "1b56c32c3679002b3a42384a580e16e2600f41c1",
"shasum": ""
},
"require": {
@ -5413,7 +5413,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v5.4.0"
"source": "https://github.com/symfony/var-dumper/tree/v5.4.2"
},
"funding": [
{
@ -5429,7 +5429,7 @@
"type": "tidelift"
}
],
"time": "2021-11-29T15:30:56+00:00"
"time": "2021-12-29T10:10:35+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@ -5486,16 +5486,16 @@
},
{
"name": "vlucas/phpdotenv",
"version": "v5.4.0",
"version": "v5.4.1",
"source": {
"type": "git",
"url": "https://github.com/vlucas/phpdotenv.git",
"reference": "d4394d044ed69a8f244f3445bcedf8a0d7fe2403"
"reference": "264dce589e7ce37a7ba99cb901eed8249fbec92f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/d4394d044ed69a8f244f3445bcedf8a0d7fe2403",
"reference": "d4394d044ed69a8f244f3445bcedf8a0d7fe2403",
"url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/264dce589e7ce37a7ba99cb901eed8249fbec92f",
"reference": "264dce589e7ce37a7ba99cb901eed8249fbec92f",
"shasum": ""
},
"require": {
@ -5533,11 +5533,13 @@
"authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk"
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{
"name": "Vance Lucas",
"email": "vance@vancelucas.com"
"email": "vance@vancelucas.com",
"homepage": "https://github.com/vlucas"
}
],
"description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
@ -5548,7 +5550,7 @@
],
"support": {
"issues": "https://github.com/vlucas/phpdotenv/issues",
"source": "https://github.com/vlucas/phpdotenv/tree/v5.4.0"
"source": "https://github.com/vlucas/phpdotenv/tree/v5.4.1"
},
"funding": [
{
@ -5560,7 +5562,7 @@
"type": "tidelift"
}
],
"time": "2021-11-10T01:08:39+00:00"
"time": "2021-12-12T23:22:04+00:00"
},
{
"name": "voku/portable-ascii",
@ -5698,16 +5700,16 @@
"packages-dev": [
{
"name": "barryvdh/laravel-debugbar",
"version": "v3.6.4",
"version": "v3.6.5",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-debugbar.git",
"reference": "3c2d678269ba60e178bcd93e36f6a91c36b727f1"
"reference": "ccf109f8755dcc7e58779d1aeb1051b04e0b4bef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/3c2d678269ba60e178bcd93e36f6a91c36b727f1",
"reference": "3c2d678269ba60e178bcd93e36f6a91c36b727f1",
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/ccf109f8755dcc7e58779d1aeb1051b04e0b4bef",
"reference": "ccf109f8755dcc7e58779d1aeb1051b04e0b4bef",
"shasum": ""
},
"require": {
@ -5735,7 +5737,7 @@
"Barryvdh\\Debugbar\\ServiceProvider"
],
"aliases": {
"Debugbar": "Barryvdh\\Debugbar\\Facade"
"Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar"
}
}
},
@ -5767,7 +5769,7 @@
],
"support": {
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.6.4"
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.6.5"
},
"funding": [
{
@ -5779,7 +5781,7 @@
"type": "github"
}
],
"time": "2021-10-21T10:57:31+00:00"
"time": "2021-12-14T14:45:18+00:00"
},
{
"name": "doctrine/instantiator",
@ -5917,16 +5919,16 @@
},
{
"name": "facade/ignition",
"version": "2.17.2",
"version": "2.17.4",
"source": {
"type": "git",
"url": "https://github.com/facade/ignition.git",
"reference": "af3cd70d58ca3ef5189ff0e59efbe5a5c043e2d2"
"reference": "95c80bd35ee6858e9e1439b2f6a698295eeb2070"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/facade/ignition/zipball/af3cd70d58ca3ef5189ff0e59efbe5a5c043e2d2",
"reference": "af3cd70d58ca3ef5189ff0e59efbe5a5c043e2d2",
"url": "https://api.github.com/repos/facade/ignition/zipball/95c80bd35ee6858e9e1439b2f6a698295eeb2070",
"reference": "95c80bd35ee6858e9e1439b2f6a698295eeb2070",
"shasum": ""
},
"require": {
@ -5991,7 +5993,7 @@
"issues": "https://github.com/facade/ignition/issues",
"source": "https://github.com/facade/ignition"
},
"time": "2021-11-29T14:04:22+00:00"
"time": "2021-12-27T15:11:24+00:00"
},
{
"name": "facade/ignition-contracts",
@ -7163,16 +7165,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.10",
"version": "9.5.11",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a"
"reference": "2406855036db1102126125537adb1406f7242fdd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a",
"reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2406855036db1102126125537adb1406f7242fdd",
"reference": "2406855036db1102126125537adb1406f7242fdd",
"shasum": ""
},
"require": {
@ -7250,11 +7252,11 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.11"
},
"funding": [
{
"url": "https://phpunit.de/donate.html",
"url": "https://phpunit.de/sponsors.html",
"type": "custom"
},
{
@ -7262,7 +7264,7 @@
"type": "github"
}
],
"time": "2021-09-25T07:38:51+00:00"
"time": "2021-12-25T07:07:57+00:00"
},
{
"name": "sebastian/cli-parser",
@ -8230,16 +8232,16 @@
},
{
"name": "symfony/debug",
"version": "v4.4.31",
"version": "v4.4.36",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "43ede438d4cb52cd589ae5dc070e9323866ba8e0"
"reference": "346e1507eeb3f566dcc7a116fefaa407ee84691b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/43ede438d4cb52cd589ae5dc070e9323866ba8e0",
"reference": "43ede438d4cb52cd589ae5dc070e9323866ba8e0",
"url": "https://api.github.com/repos/symfony/debug/zipball/346e1507eeb3f566dcc7a116fefaa407ee84691b",
"reference": "346e1507eeb3f566dcc7a116fefaa407ee84691b",
"shasum": ""
},
"require": {
@ -8278,7 +8280,7 @@
"description": "Provides tools to ease debugging PHP code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/debug/tree/v4.4.31"
"source": "https://github.com/symfony/debug/tree/v4.4.36"
},
"funding": [
{
@ -8294,7 +8296,7 @@
"type": "tidelift"
}
],
"time": "2021-09-24T13:30:14+00:00"
"time": "2021-11-29T08:40:48+00:00"
},
{
"name": "theseer/tokenizer",

View file

@ -49,6 +49,12 @@ return [
*/
'everyone_is_admin' => env('APP_EVERYONE_IS_ADMIN', false),
/**
* Allow admins to handle all the accounts in the database
* ENABLE IT AT YOUR OWN RISKS IN PRODUCTION
*/
'admins_manage_multi_domains' => env('APP_ADMINS_MANAGE_MULTI_DOMAINS', false),
/*
|--------------------------------------------------------------------------
| Application Environment

View file

@ -98,4 +98,4 @@ An adminisator can create, edit and delete account types. Those can be used to c
## Statistics
The statistics panel show registrations statistics based on their type (mobile and email based registration) and their activations states.
The statistics panel show registrations statistics based on their type (mobile and email based registration) and their activations states.

View file

@ -38,10 +38,17 @@
<div class="form-group col-md-12">
{!! Form::label('username', 'Username') !!}
<div class="input-group">
{!! Form::text('username', $account->username, ['class' => 'form-control', 'placeholder' => 'Username']); !!}
<div class="input-group-append">
<span class="input-group-text" id="basic-addon1">@ {{ config('app.sip_domain') }}</span>
</div>
{!! Form::text('username', $account->username, ['class' => 'form-control', 'placeholder' => 'Username', 'required' => 'required']); !!}
@if (config('app.admins_manage_multi_domains'))
<div class="input-group-append">
<span class="input-group-text" id="basic-addon1">@</span>
</div>
{!! Form::text('username', $account->domain ?? config('app.sip_domain'), ['class' => 'form-control', 'placeholder' => 'domain.com', 'required' => 'required']); !!}
@else
<div class="input-group-append">
<span class="input-group-text" id="basic-addon1">@ {{ config('app.sip_domain') }}</span>
</div>
@endif
</div>
</div>
</div>

View file

@ -173,7 +173,7 @@ JSON parameters:
* `username` unique username, minimum 6 characters
* `password` required minimum 6 characters
* `algorithm` required, values can be `SHA-256` or `MD5`
* `domain` **not configurable except during test deployments** the value is enforced to the default registration domain set in the global configuration
* `domain` **not configurable by default, except if `admins_manage_multi_domains` is set to `true` in the configuration** the value is enforced to the default registration domain set in the global configuration
* `activated` optional, a boolean, set to `false` by default
* `display_name` optional, string
* `admin` optional, a boolean, set to `false` by default, create an admin account
@ -282,33 +282,33 @@ Retrieve registrations statistics for a month.
# Non-API Endpoints
The following URLs are **not API endpoints**, they are not located under `/api` but directly under the root path.
The following URLs are **not REST API endpoints**, they are not located under `/api` but directly under the root path.
## Provisioning
When an account is having an available `confirmation_key` it can be provisioned using the two following URL.
### `VISIT /provisioning/`
### `GET /provisioning/`
Return the provisioning information available in the liblinphone configuration file (if correctly configured).
### `VISIT /provisioning/{confirmation_key}`
### `GET /provisioning/{confirmation_key}`
Return the provisioning information available in the liblinphone configuration file.
If the `confirmation_key` is valid the related account information are added to the returned XML. The account is then considered as "provisioned" and those account related information will be removed in the upcoming requests (the content will be the same as the previous url).
If the account is not activated and the `confirmation_key` is valid. The account will be activated.
### `VISIT /provisioning/qrcode/{confirmation_key}`
### `GET /provisioning/qrcode/{confirmation_key}`
Return a QRCode that points to the provisioning URL.
## Authenticated provisioning
### `VISIT /provisioning/me`
### `GET /provisioning/me`
Return the same base content as the previous URL and the account related information, similar to the `confirmation_key` endpoint. However this endpoint will always return those information.
## Authenticated contact list
### `VISIT /contacts/vcard`
### `GET /contacts/vcard`
Return the authenticated user contacts list, in [vCard 4.0 format](https://datatracker.ietf.org/doc/html/rfc6350).
### `VISIT /contacts/vcard/{sip}`
### `GET /contacts/vcard/{sip}`
Return a specific user authenticated contact, in [vCard 4.0 format](https://datatracker.ietf.org/doc/html/rfc6350).

View file

@ -5,7 +5,7 @@
<div class="collapse navbar-collapse" >
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/">{{ config('app.name') }}</a>
<a class="nav-link" href="{{ route('account.home') }}">{{ config('app.name') }}</a>
</li>
@if (isset($user) && get_class($user) == 'App\Account')
<li class="nav-item active">

View file

@ -118,7 +118,7 @@ class AccountApiTest extends TestCase
public function testDomainInTestDeployment()
{
$configDomain = 'testdomain.com';
config()->set('app.everyone_is_admin', true);
config()->set('app.admins_manage_multi_domains', true);
config()->set('app.sip_domain', 'anotherdomain.com');
$admin = Admin::factory()->create();

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 118
%define build_number 119
%define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager