mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 14:20:47 +08:00
Remove superfluous ForbiddenException
It has the same effect as the PermissionDeniedException, so let's just use that. Refs #1641.
This commit is contained in:
parent
5d5ebc088e
commit
e7c12ce928
|
@ -10,8 +10,8 @@
|
||||||
namespace Flarum\Extension;
|
namespace Flarum\Extension;
|
||||||
|
|
||||||
use Flarum\Extension\Event\Disabling;
|
use Flarum\Extension\Event\Disabling;
|
||||||
use Flarum\Http\Exception\ForbiddenException;
|
|
||||||
use Flarum\Settings\SettingsRepositoryInterface;
|
use Flarum\Settings\SettingsRepositoryInterface;
|
||||||
|
use Flarum\User\Exception\PermissionDeniedException;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
class DefaultLanguagePackGuard
|
class DefaultLanguagePackGuard
|
||||||
|
@ -36,7 +36,7 @@ class DefaultLanguagePackGuard
|
||||||
$locale = Arr::get($event->extension->extra, 'flarum-locale.code');
|
$locale = Arr::get($event->extension->extra, 'flarum-locale.code');
|
||||||
|
|
||||||
if ($locale === $defaultLocale) {
|
if ($locale === $defaultLocale) {
|
||||||
throw new ForbiddenException('You cannot disable the default language pack!');
|
throw new PermissionDeniedException('You cannot disable the default language pack!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ class ErrorServiceProvider extends AbstractServiceProvider
|
||||||
'invalid_access_token' => 401,
|
'invalid_access_token' => 401,
|
||||||
|
|
||||||
// 403 Forbidden
|
// 403 Forbidden
|
||||||
'forbidden' => 403,
|
|
||||||
'invalid_confirmation_token' => 403,
|
'invalid_confirmation_token' => 403,
|
||||||
'permission_denied' => 403,
|
'permission_denied' => 403,
|
||||||
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of Flarum.
|
|
||||||
*
|
|
||||||
* For detailed copyright and license information, please view the
|
|
||||||
* LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Flarum\Http\Exception;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Flarum\Foundation\KnownError;
|
|
||||||
|
|
||||||
class ForbiddenException extends Exception implements KnownError
|
|
||||||
{
|
|
||||||
public function getType(): string
|
|
||||||
{
|
|
||||||
return 'forbidden';
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user