Fix an authentication issue in the Account global domain scope

This commit is contained in:
Timothée Jaussoin 2022-01-06 12:31:34 +01:00
parent 0338872c26
commit 5d508d96d8
3 changed files with 28 additions and 24 deletions

View file

@ -51,8 +51,12 @@ class Account extends Authenticatable
protected static function booted()
{
static::addGlobalScope('domain', function (Builder $builder) {
$user = Auth::user();
if (!$user || !$user->admin || !config('app.admins_manage_multi_domains')) {
if (Auth::hasUser()) {
$user = Auth::user();
if (!$user->admin || !config('app.admins_manage_multi_domains')) {
$builder->where('domain', config('app.sip_domain'));
}
} else {
$builder->where('domain', config('app.sip_domain'));
}
});

42
flexiapi/composer.lock generated
View file

@ -404,16 +404,16 @@
},
{
"name": "doctrine/dbal",
"version": "3.2.0",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "5d54f63541d7bed1156cb5c9b79274ced61890e4"
"reference": "4caf37acf14b513a91dd4f087f7eda424fa25542"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/5d54f63541d7bed1156cb5c9b79274ced61890e4",
"reference": "5d54f63541d7bed1156cb5c9b79274ced61890e4",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/4caf37acf14b513a91dd4f087f7eda424fa25542",
"reference": "4caf37acf14b513a91dd4f087f7eda424fa25542",
"shasum": ""
},
"require": {
@ -428,14 +428,14 @@
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2021.1",
"phpstan/phpstan": "1.2.0",
"phpstan/phpstan": "1.3.0",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "9.5.10",
"phpunit/phpunit": "9.5.11",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.6.1",
"squizlabs/php_codesniffer": "3.6.2",
"symfony/cache": "^5.2|^6.0",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0|^6.0",
"vimeo/psalm": "4.13.0"
"vimeo/psalm": "4.16.1"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
@ -495,7 +495,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.2.0"
"source": "https://github.com/doctrine/dbal/tree/3.2.1"
},
"funding": [
{
@ -511,7 +511,7 @@
"type": "tidelift"
}
],
"time": "2021-11-26T21:00:12+00:00"
"time": "2022-01-05T08:52:06+00:00"
},
{
"name": "doctrine/deprecations",
@ -823,16 +823,16 @@
},
{
"name": "dragonmantank/cron-expression",
"version": "v3.2.2",
"version": "v3.2.3",
"source": {
"type": "git",
"url": "https://github.com/dragonmantank/cron-expression.git",
"reference": "c9e208317b0cf679097cf976ffbb0b0eec81d4df"
"reference": "47c53bbb260d3c398fba9bfa9683dcf67add2579"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/c9e208317b0cf679097cf976ffbb0b0eec81d4df",
"reference": "c9e208317b0cf679097cf976ffbb0b0eec81d4df",
"url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/47c53bbb260d3c398fba9bfa9683dcf67add2579",
"reference": "47c53bbb260d3c398fba9bfa9683dcf67add2579",
"shasum": ""
},
"require": {
@ -872,7 +872,7 @@
],
"support": {
"issues": "https://github.com/dragonmantank/cron-expression/issues",
"source": "https://github.com/dragonmantank/cron-expression/tree/v3.2.2"
"source": "https://github.com/dragonmantank/cron-expression/tree/v3.2.3"
},
"funding": [
{
@ -880,7 +880,7 @@
"type": "github"
}
],
"time": "2022-01-05T06:05:42+00:00"
"time": "2022-01-06T05:35:07+00:00"
},
{
"name": "egulias/email-validator",
@ -1459,16 +1459,16 @@
},
{
"name": "laravel/framework",
"version": "v8.78.0",
"version": "v8.78.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "3b0e46985c65e06bfe3fafd2a28ab122667b20f4"
"reference": "16359b5ebafba6579b397d7505b082a6d1bb2e31"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/3b0e46985c65e06bfe3fafd2a28ab122667b20f4",
"reference": "3b0e46985c65e06bfe3fafd2a28ab122667b20f4",
"url": "https://api.github.com/repos/laravel/framework/zipball/16359b5ebafba6579b397d7505b082a6d1bb2e31",
"reference": "16359b5ebafba6579b397d7505b082a6d1bb2e31",
"shasum": ""
},
"require": {
@ -1627,7 +1627,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2022-01-04T16:23:21+00:00"
"time": "2022-01-05T14:52:50+00:00"
},
{
"name": "laravel/serializable-closure",

View file

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