Fix middleware for admin area.

This commit is contained in:
James Cole
2026-02-28 06:15:28 +01:00
parent bd14273201
commit 6cfd8273fe
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -156,8 +156,13 @@ $app = Application::configure(basePath: dirname(__DIR__))
]);
// This middleware is added to ensure that the user is not only logged in and
// authenticated (with MFA and everything), but also admin.
$middleware->appendToGroup('api-admin', [
IsAdmin::class,
]);
$middleware->appendToGroup('admin', [
IsAdmin::class,
Range::class,
InterestingMessage::class
]);
// if the user is not logged in, this group applies.
+3 -3
View File
@@ -347,7 +347,7 @@ Route::group(
'namespace' => 'FireflyIII\Api\V1\Controllers\Models\UserGroup',
'prefix' => 'v1/user-groups',
'as' => 'api.v1.user-groups.',
'middleware' => ['admin'],
'middleware' => ['api-admin'],
],
static function (): void {
Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
@@ -724,7 +724,7 @@ Route::group(
'namespace' => 'FireflyIII\Api\V1\Controllers\System',
'prefix' => 'v1/configuration',
'as' => 'api.v1.configuration.',
'middleware' => ['admin'],
'middleware' => ['api-admin'],
],
static function (): void {
Route::get('', ['uses' => 'ConfigurationController@index', 'as' => 'index']);
@@ -738,7 +738,7 @@ Route::group(
'namespace' => 'FireflyIII\Api\V1\Controllers\System',
'prefix' => 'v1/users',
'as' => 'api.v1.users.',
'middleware' => ['admin'],
'middleware' => ['api-admin'],
],
static function (): void {
Route::get('', ['uses' => 'UserController@index', 'as' => 'index']);