Laravel 9.x Shift (#14504)

* Move `resources/lang` folder

* Shift registered middleware

* Remove `fruitcake/laravel-cors` dependency

* Streamline `$commands` property

* Upgrade to Flysystem 3.0

* Shift core files

* Convert `optional()` to nullsafe operator

* Remove unnecessary `$model` property

* Convert route options to fluent methods

Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods.

* Convert deprecated `$dates` property to `$casts`

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.

* Bump Laravel dependencies

* Use `<env>` tags for configuration

`<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI.

Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/

* Fix error provider

* Match new symfony syntax

* Match upstream syntax

* Fix route syntax

* generate composer.lock

* Sync back configs

* routes

* composer

* Fix more flare

* fix cors

* sync lang

* Apply fixes from StyleCI (#14517)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* bump larastan

* update packages

* wip

* Temporarily lower phpstan level

* Update phpstan.neon

* wip

* wip

* wip

* Apply fixes from StyleCI (#14592)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* test

* Update CiHelper.php

* Update test.yml

* Update CiHelper.php

* Update CiHelper.php

* Apply fixes from StyleCI (#14616)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* test?

* fix phpstan problems

* dont run snmpsim on github ci

* Fix whitespace

* More whitespace

* More whitespace ???

* I think the space broke it

* fix the reset of the whitespace

* hard code auth guard

---------

Co-authored-by: Shift <shift@laravelshift.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Jellyfrog
2023-04-17 13:51:35 +02:00
committed by GitHub
parent 8941153c58
commit 0a351b49fd
209 changed files with 2754 additions and 2368 deletions

View File

@@ -11,7 +11,7 @@
|
*/
Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function () {
Route::prefix('v0')->namespace('\App\Api\Controllers')->group(function () {
Route::get('system', 'LegacyApiController@server_info')->name('server_info');
Route::get('', 'LegacyApiController@show_endpoints');
@@ -37,7 +37,7 @@ Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function
Route::get('services', 'LegacyApiController@list_services')->name('list_services');
Route::get('services/{hostname}', 'LegacyApiController@list_services')->name('list_services_device');
Route::group(['prefix' => 'resources'], function () {
Route::prefix('resources')->group(function () {
Route::get('links/{id}', 'LegacyApiController@get_link')->name('get_link');
Route::get('locations', 'LegacyApiController@list_locations')->name('list_locations');
Route::get('ip/addresses', 'LegacyApiController@list_ip_addresses')->name('list_ip_addresses');
@@ -46,7 +46,7 @@ Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function
Route::get('ip/networks/{id}/ip', 'LegacyApiController@get_network_ip_addresses')->name('get_network_ip_addresses');
});
Route::group(['prefix' => 'logs'], function () {
Route::prefix('logs')->group(function () {
Route::get('eventlog/{hostname?}', 'LegacyApiController@list_logs')->name('list_eventlog');
Route::get('syslog/{hostname?}', 'LegacyApiController@list_logs')->name('list_syslog');
Route::get('alertlog/{hostname?}', 'LegacyApiController@list_logs')->name('list_alertlog');
@@ -56,7 +56,7 @@ Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function
// admin required
Route::middleware(['can:admin'])->group(function () {
Route::group(['prefix' => 'devices'], function () {
Route::prefix('devices')->group(function () {
Route::post('', 'LegacyApiController@add_device')->name('add_device');
Route::delete('{hostname}', 'LegacyApiController@del_device')->name('del_device');
Route::patch('{hostname}', 'LegacyApiController@update_device')->name('update_device_field');
@@ -67,7 +67,7 @@ Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function
Route::post('{hostname}/maintenance', 'LegacyApiController@maintenance_device')->name('maintenance_device');
});
Route::group(['prefix' => 'devicegroups'], function () {
Route::prefix('devicegroups')->group(function () {
Route::post('{name}/maintenance', 'LegacyApiController@maintenance_devicegroup')->name('maintenance_devicegroup');
});
@@ -98,7 +98,7 @@ Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function
});
// restricted by access
Route::group(['prefix' => 'devices'], function () {
Route::prefix('devices')->group(function () {
Route::get('{hostname}', 'LegacyApiController@get_device')->name('get_device');
Route::get('{hostname}/discover', 'LegacyApiController@trigger_device_discovery')->name('trigger_device_discovery');
Route::get('{hostname}/availability', 'LegacyApiController@device_availability')->name('device_availability');
@@ -124,7 +124,7 @@ Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function
Route::get('', 'LegacyApiController@list_devices')->name('list_devices');
});
Route::group(['prefix' => 'ports'], function () {
Route::prefix('ports')->group(function () {
Route::get('{portid}', 'LegacyApiController@get_port_info')->name('get_port_info');
Route::get('{portid}/ip', 'LegacyApiController@get_port_ip_addresses')->name('get_port_ip_info');
Route::get('search/{field}/{search?}', 'LegacyApiController@search_ports')->name('search_ports')->where('search', '.*');
@@ -132,7 +132,7 @@ Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function
Route::get('', 'LegacyApiController@get_all_ports')->name('get_all_ports');
});
Route::group(['prefix' => 'bills'], function () {
Route::prefix('bills')->group(function () {
Route::get('', 'LegacyApiController@list_bills')->name('list_bills');
Route::get('{bill_id}', 'LegacyApiController@list_bills')->name('get_bill');
Route::get('{bill_id}/graphs/{graph_type}', 'LegacyApiController@get_bill_graph')->name('get_bill_graph');
@@ -142,14 +142,14 @@ Route::group(['prefix' => 'v0', 'namespace' => '\App\Api\Controllers'], function
Route::get('{bill_id}/history/{bill_hist_id}/graphdata/{graph_type}', 'LegacyApiController@get_bill_history_graphdata')->name('get_bill_history_graphdata');
});
Route::group(['prefix' => 'routing'], function () {
Route::prefix('routing')->group(function () {
Route::get('bgp/cbgp', 'LegacyApiController@list_cbgp')->name('list_cbgp');
Route::get('vrf', 'LegacyApiController@list_vrf')->name('list_vrf');
Route::get('mpls/services', 'LegacyApiController@list_mpls_services')->name('list_mpls_services');
Route::get('mpls/saps', 'LegacyApiController@list_mpls_saps')->name('list_mpls_saps');
});
Route::group(['prefix' => 'resources'], function () {
Route::prefix('resources')->group(function () {
Route::get('fdb', 'LegacyApiController@list_fdb')->name('list_fdb');
Route::get('fdb/{mac}', 'LegacyApiController@list_fdb')->name('list_fdb_mac');
Route::get('links', 'LegacyApiController@list_links')->name('list_links');

View File

@@ -17,23 +17,23 @@ use Illuminate\Support\Facades\Route;
Auth::routes(['register' => false, 'reset' => false, 'verify' => false]);
// Socialite
Route::prefix('auth')->name('socialite.')->group(function () {
Route::post('{provider}/redirect', [\App\Http\Controllers\Auth\SocialiteController::class, 'redirect'])->name('redirect');
Route::match(['get', 'post'], '{provider}/callback', [\App\Http\Controllers\Auth\SocialiteController::class, 'callback'])->name('callback');
Route::get('{provider}/metadata', [\App\Http\Controllers\Auth\SocialiteController::class, 'metadata'])->name('metadata');
Route::prefix('auth:web')->name('socialite.')->group(function () {
Route::post('{provider}/redirect', [Auth\SocialiteController::class, 'redirect'])->name('redirect');
Route::match(['get', 'post'], '{provider}/callback', [Auth\SocialiteController::class, 'callback'])->name('callback');
Route::get('{provider}/metadata', [Auth\SocialiteController::class, 'metadata'])->name('metadata');
});
Route::get('graph/{path?}', 'GraphController')
Route::get('graph/{path?}', GraphController::class)
->where('path', '.*')
->middleware(['web', \App\Http\Middleware\AuthenticateGraph::class])->name('graph');
// WebUI
Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
Route::middleware(['auth'])->group(function () {
// pages
Route::post('alert/{alert}/ack', [\App\Http\Controllers\AlertController::class, 'ack'])->name('alert.ack');
Route::post('alert/{alert}/ack', [AlertController::class, 'ack'])->name('alert.ack');
Route::resource('device-groups', 'DeviceGroupController');
Route::resource('port', 'PortController', ['only' => 'update']);
Route::group(['prefix' => 'poller'], function () {
Route::resource('port', 'PortController')->only('update');
Route::prefix('poller')->group(function () {
Route::get('', 'PollerController@pollerTab')->name('poller.index');
Route::get('log', 'PollerController@logTab')->name('poller.log');
Route::get('groups', 'PollerController@groupsTab')->name('poller.groups');
@@ -48,7 +48,7 @@ Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
Route::post('templates/remove/{template}', 'ServiceTemplateController@remove')->name('templates.remove');
});
Route::get('locations', 'LocationController@index');
Route::resource('preferences', 'UserPreferencesController', ['only' => ['index', 'store']]);
Route::resource('preferences', 'UserPreferencesController')->only('index', 'store');
Route::resource('users', 'UserController');
Route::get('about', [\App\Http\Controllers\AboutController::class, 'index'])->name('about');
Route::delete('reporting', [\App\Http\Controllers\AboutController::class, 'clearReportingData'])->name('reporting.clear');
@@ -58,15 +58,15 @@ Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
Route::view('vminfo', 'vminfo');
// Device Tabs
Route::group(['prefix' => 'device/{device}', 'namespace' => 'Device\Tabs', 'as' => 'device.'], function () {
Route::prefix('device/{device}')->namespace('Device\Tabs')->name('device.')->group(function () {
Route::put('notes', 'NotesController@update')->name('notes.update');
});
Route::match(['get', 'post'], 'device/{device}/{tab?}/{vars?}', 'DeviceController@index')
->name('device')->where(['vars' => '.*']);
->name('device')->where('vars', '.*');
// Maps
Route::group(['prefix' => 'maps', 'namespace' => 'Maps'], function () {
Route::prefix('maps')->namespace('Maps')->group(function () {
Route::get('devicedependency', 'DeviceDependencyController@dependencyMap');
});
@@ -80,42 +80,42 @@ Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
Route::put('dashboard/widgets/{widget}', 'WidgetSettingsController@update')->name('dashboard.widget.settings');
// Push notifications
Route::group(['prefix' => 'push'], function () {
Route::get('token', [\App\Http\Controllers\PushNotificationController::class, 'token'])->name('push.token');
Route::get('key', [\App\Http\Controllers\PushNotificationController::class, 'key'])->name('push.key');
Route::post('register', [\App\Http\Controllers\PushNotificationController::class, 'register'])->name('push.register');
Route::post('unregister', [\App\Http\Controllers\PushNotificationController::class, 'unregister'])->name('push.unregister');
Route::prefix('push')->group(function () {
Route::get('token', [PushNotificationController::class, 'token'])->name('push.token');
Route::get('key', [PushNotificationController::class, 'key'])->name('push.key');
Route::post('register', [PushNotificationController::class, 'register'])->name('push.register');
Route::post('unregister', [PushNotificationController::class, 'unregister'])->name('push.unregister');
});
// admin pages
Route::group(['middleware' => ['can:admin']], function () {
Route::middleware('can:admin')->group(function () {
Route::get('settings/{tab?}/{section?}', 'SettingsController@index')->name('settings');
Route::put('settings/{name}', 'SettingsController@update')->name('settings.update');
Route::delete('settings/{name}', 'SettingsController@destroy')->name('settings.destroy');
Route::post('alert/transports/{transport}/test', [\App\Http\Controllers\AlertTransportController::class, 'test'])->name('alert.transports.test');
Route::post('alert/transports/{transport}/test', [AlertTransportController::class, 'test'])->name('alert.transports.test');
Route::get('plugin/settings', 'PluginAdminController')->name('plugin.admin');
Route::get('plugin/settings/{plugin:plugin_name}', 'PluginSettingsController')->name('plugin.settings');
Route::get('plugin/settings', PluginAdminController::class)->name('plugin.admin');
Route::get('plugin/settings/{plugin:plugin_name}', PluginSettingsController::class)->name('plugin.settings');
Route::post('plugin/settings/{plugin:plugin_name}', 'PluginSettingsController@update')->name('plugin.update');
Route::resource('port-groups', 'PortGroupController');
Route::get('validate', [\App\Http\Controllers\ValidateController::class, 'index'])->name('validate');
Route::get('validate/results', [\App\Http\Controllers\ValidateController::class, 'runValidation'])->name('validate.results');
Route::post('validate/fix', [\App\Http\Controllers\ValidateController::class, 'runFixer'])->name('validate.fix');
Route::get('validate', [ValidateController::class, 'index'])->name('validate');
Route::get('validate/results', [ValidateController::class, 'runValidation'])->name('validate.results');
Route::post('validate/fix', [ValidateController::class, 'runFixer'])->name('validate.fix');
});
Route::get('plugin', 'PluginLegacyController@redirect');
Route::redirect('plugin/view=admin', '/plugin/admin');
Route::get('plugin/p={pluginName}', 'PluginLegacyController@redirect');
Route::any('plugin/v1/{plugin:plugin_name}/{other?}', 'PluginLegacyController')->where('other', '(.*)')->name('plugin.legacy');
Route::get('plugin/{plugin:plugin_name}', 'PluginPageController')->name('plugin.page');
Route::any('plugin/v1/{plugin:plugin_name}/{other?}', PluginLegacyController::class)->where('other', '(.*)')->name('plugin.legacy');
Route::get('plugin/{plugin:plugin_name}', PluginPageController::class)->name('plugin.page');
// old route redirects
Route::permanentRedirect('poll-log', 'poller/log');
// Two Factor Auth
Route::group(['prefix' => '2fa', 'namespace' => 'Auth'], function () {
Route::prefix('2fa')->namespace('Auth')->group(function () {
Route::get('', 'TwoFactorController@showTwoFactorForm')->name('2fa.form');
Route::post('', 'TwoFactorController@verifyTwoFactor')->name('2fa.verify');
Route::post('add', 'TwoFactorController@create')->name('2fa.add');
@@ -127,15 +127,15 @@ Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
});
// Ajax routes
Route::group(['prefix' => 'ajax'], function () {
Route::prefix('ajax')->group(function () {
// page ajax controllers
Route::resource('location', 'LocationController', ['only' => ['update', 'destroy']]);
Route::resource('pollergroup', 'PollerGroupController', ['only' => ['destroy']]);
Route::resource('location', 'LocationController')->only('update', 'destroy');
Route::resource('pollergroup', 'PollerGroupController')->only('destroy');
// misc ajax controllers
Route::group(['namespace' => 'Ajax'], function () {
Route::get('search/bgp', 'BgpSearchController');
Route::get('search/device', 'DeviceSearchController');
Route::get('search/port', 'PortSearchController');
Route::namespace('Ajax')->group(function () {
Route::get('search/bgp', BgpSearchController::class);
Route::get('search/device', DeviceSearchController::class);
Route::get('search/port', PortSearchController::class);
Route::post('set_map_group', 'AvailabilityMapController@setGroup');
Route::post('set_map_view', 'AvailabilityMapController@setView');
Route::post('set_resolution', 'ResolutionController@set');
@@ -147,7 +147,7 @@ Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
Route::get('settings/list', 'SettingsController@listAll')->name('settings.list');
// js select2 data controllers
Route::group(['prefix' => 'select', 'namespace' => 'Select'], function () {
Route::prefix('select')->namespace('Select')->group(function () {
Route::get('application', 'ApplicationController')->name('ajax.select.application');
Route::get('bill', 'BillController')->name('ajax.select.bill');
Route::get('dashboard', 'DashboardController')->name('ajax.select.dashboard');
@@ -170,7 +170,7 @@ Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
});
// jquery bootgrid data controllers
Route::group(['prefix' => 'table', 'namespace' => 'Table'], function () {
Route::prefix('table')->namespace('Table')->group(function () {
Route::post('alert-schedule', 'AlertScheduleController');
Route::post('customers', 'CustomersController');
Route::post('device', 'DeviceController');
@@ -190,7 +190,7 @@ Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
});
// dashboard widgets
Route::group(['prefix' => 'dash', 'namespace' => 'Widgets'], function () {
Route::prefix('dash')->namespace('Widgets')->group(function () {
Route::post('alerts', 'AlertsController');
Route::post('alertlog', 'AlertlogController');
Route::post('availability-map', 'AvailabilityMapController');
@@ -220,7 +220,7 @@ Route::group(['middleware' => ['auth'], 'guard' => 'auth'], function () {
});
// installation routes
Route::group(['prefix' => 'install', 'namespace' => 'Install'], function () {
Route::prefix('install')->namespace('Install')->group(function () {
Route::get('/', 'InstallationController@redirectToFirst')->name('install');
Route::get('/checks', 'ChecksController@index')->name('install.checks');
Route::get('/database', 'DatabaseController@index')->name('install.database');