Tony Murray 6e6e54cb98 New User Management (#9348)
* Rewrite user management.

Error management

Revert edituser legacy page

Connect user permissions button to legacy page for now.

Implement user creation
Refine form

Remove PingCheck.php accidental add :)

Fixes for redirection and deletion

More fixes: realname accidental validation setting, hide can modify for read-only auths

Use a panel to improve style

Add icon to panel-title

Not allowed to delete own user (at least via the click of a button)

Use request validation to reduce complexity of controller.
Improve protection against users doing things they should not.

Switch to horizontal form and not nearly as wide of layout :)

delete without refresh.
Fix for buttons

Include all users (not just from this auth)
Hide the auth column if there is only one auth type

Show username if real name isn't set

Don't allow creation of demo users via the webui

a fix to the lnms user:add command, it didn't set auth_id

update edituser.inc.php to current
just redirect to users page

* Remove TwoFactorTest for now

* Update edituser.inc.php

* Update .env.dusk.testing

* Enable 2fa for 2fa test...
2019-04-22 19:01:39 -05:00

125 lines
5.2 KiB
PHP

<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
// Auth
Auth::routes();
// WebUI
Route::group(['middleware' => ['auth', '2fa'], 'guard' => 'auth'], function () {
// Test
Route::get('/laravel', function () {
return view('laravel');
});
// pages
Route::get('locations', 'LocationController@index');
// old route redirects
Route::permanentRedirect('poll-log', 'pollers/tab=log/');
// Two Factor Auth
Route::group(['prefix' => '2fa', 'namespace' => 'Auth'], function () {
Route::get('', 'TwoFactorController@showTwoFactorForm')->name('2fa.form');
Route::post('', 'TwoFactorController@verifyTwoFactor')->name('2fa.verify');
Route::post('add', 'TwoFactorController@create');
Route::post('cancel', 'TwoFactorController@cancelAdd')->name('2fa.cancel');
Route::post('remove', 'TwoFactorController@destroy')->name('2fa.remove');
Route::post('{user}/unlock', 'TwoFactorManagementController@unlock')->name('2fa.unlock');
Route::delete('{user}', 'TwoFactorManagementController@destroy')->name('2fa.delete');
});
Route::resource('users', 'UserController');
// Ajax routes
Route::group(['prefix' => 'ajax'], function () {
// page ajax controllers
Route::resource('location', 'LocationController', ['only' => ['update', 'destroy']]);
// misc ajax controllers
Route::group(['namespace' => 'Ajax'], function () {
Route::post('set_resolution', 'ResolutionController@set');
Route::get('netcmd', 'NetCommand@run');
Route::post('ripe/raw', 'RipeNccApiController@raw');
});
// form ajax handlers, perhaps should just be page controllers
Route::group(['prefix' => 'form', 'namespace' => 'Form'], function () {
Route::resource('widget-settings', 'WidgetSettingsController');
});
// js select2 data controllers
Route::group(['prefix' => 'select', 'namespace' => 'Select'], function () {
Route::get('application', 'ApplicationController');
Route::get('bill', 'BillController');
Route::get('device', 'DeviceController');
Route::get('device-field', 'DeviceFieldController');
Route::get('device-group', 'DeviceGroupController');
Route::get('eventlog', 'EventlogController');
Route::get('graph', 'GraphController');
Route::get('graph-aggregate', 'GraphAggregateController');
Route::get('graylog-streams', 'GraylogStreamsController');
Route::get('syslog', 'SyslogController');
Route::get('location', 'LocationController');
Route::get('munin', 'MuninPluginController');
Route::get('port', 'PortController');
Route::get('port-field', 'PortFieldController');
});
// jquery bootgrid data controllers
Route::group(['prefix' => 'table', 'namespace' => 'Table'], function () {
Route::post('customers', 'CustomersController');
Route::post('device', 'DeviceController');
Route::post('eventlog', 'EventlogController');
Route::post('fdb-tables', 'FdbTablesController');
Route::post('graylog', 'GraylogController');
Route::post('location', 'LocationController');
Route::post('port-nac', 'PortNacController');
Route::post('syslog', 'SyslogController');
});
// dashboard widgets
Route::group(['prefix' => 'dash', 'namespace' => 'Widgets'], function () {
Route::post('alerts', 'AlertsController');
Route::post('availability-map', 'AvailabilityMapController');
Route::post('component-status', 'ComponentStatusController');
Route::post('device-summary-horiz', 'DeviceSummaryHorizController');
Route::post('device-summary-vert', 'DeviceSummaryVertController');
Route::post('eventlog', 'EventlogController');
Route::post('generic-graph', 'GraphController');
Route::post('generic-image', 'ImageController');
Route::post('globe', 'GlobeController');
Route::post('graylog', 'GraylogController');
Route::post('placeholder', 'PlaceholderController');
Route::post('notes', 'NotesController');
Route::post('server-stats', 'ServerStatsController');
Route::post('syslog', 'SyslogController');
Route::post('top-devices', 'TopDevicesController');
Route::post('top-interfaces', 'TopInterfacesController');
Route::post('worldmap', 'WorldMapController');
});
});
// demo helper
Route::permanentRedirect('demo', '/');
// blank page, dummy page for external code using Laravel::bootWeb()
Route::any('/blank', function () {
return '';
});
// Legacy routes
Route::any('/{path?}', 'LegacyController@index')
->where('path', '^((?!_debugbar).)*');
});