snipe-it/routes/web.php

467 lines
14 KiB
PHP
Raw Normal View History

2016-03-25 01:18:05 -07:00
<?php
2017-01-13 00:13:57 -08:00
2016-03-25 01:18:05 -07:00
Route::group(['middleware' => 'auth'], function () {
2017-05-22 21:31:47 -07:00
/*
* Companies
*/
Route::resource('companies', 'CompaniesController', [
'parameters' => ['company' => 'company_id']
]);
/*
* Categories
*/
Route::resource('categories', 'CategoriesController', [
'parameters' => ['category' => 'category_id']
]);
/*
* Locations
*/
Route::resource('locations', 'LocationsController', [
'parameters' => ['location' => 'location_id']
]);
/*
* Manufacturers
*/
Route::group([ 'prefix' => 'manufacturers', 'middleware' => ['auth'] ], function () {
Route::get('{manufacturers_id}/restore', [ 'as' => 'restore/manufacturer', 'uses' => 'ManufacturersController@restore']);
});
2017-05-22 21:31:47 -07:00
Route::resource('manufacturers', 'ManufacturersController', [
'parameters' => ['manufacturer' => 'manufacturers_id']
]);
/*
* Suppliers
*/
Route::resource('suppliers', 'SuppliersController', [
'parameters' => ['supplier' => 'supplier_id']
]);
/*
* Depreciations
*/
Route::resource('depreciations', 'DepreciationsController', [
'parameters' => ['depreciation' => 'depreciation_id']
]);
/*
* Status Labels
*/
Route::resource('statuslabels', 'StatuslabelsController', [
'parameters' => ['statuslabel' => 'statuslabel_id']
]);
/*
* Departments
*/
Route::resource('departments', 'DepartmentsController', [
'parameters' => ['department' => 'department_id']
]);
2017-01-13 00:13:57 -08:00
});
/*
|
|--------------------------------------------------------------------------
| Re-Usable Modal Dialog routes.
|--------------------------------------------------------------------------
|
| Routes for various modal dialogs to interstitially create various things
|
*/
Route::group(['middleware' => 'auth','prefix' => 'modals'], function () {
Route::get('location',['as' => 'modal.location','uses' => 'ModalController@location']);
Route::get('category',['as' => 'modal.category','uses' => 'ModalController@category']);
Route::get('manufacturer',['as' => 'modal.manufacturer','uses' => 'ModalController@manufacturer']);
Route::get('model',['as' => 'modal.model','uses' => 'ModalController@model']);
Route::get('statuslabel',['as' => 'modal.statuslabel','uses' => 'ModalController@statuslabel']);
Route::get('supplier',['as' => 'modal.supplier','uses' => 'ModalController@supplier']);
Route::get('user',['as' => 'modal.user','uses' => 'ModalController@user']);
});
2017-01-13 00:13:57 -08:00
/*
|--------------------------------------------------------------------------
| Log Routes
|--------------------------------------------------------------------------
|
| Register all the admin routes.
|
*/
Route::group(['middleware' => 'auth'], function () {
Route::get(
'display-sig/{filename}',
[
'as' => 'log.signature.view',
'uses' => 'ActionlogController@displaySig' ]
);
});
2016-03-25 01:18:05 -07:00
/*
|--------------------------------------------------------------------------
| Admin Routes
|--------------------------------------------------------------------------
|
| Register all the admin routes.
|
*/
2016-08-02 00:54:38 -07:00
Route::group([ 'prefix' => 'admin','middleware' => ['auth', 'authorize:superuser']], function () {
2016-03-25 01:18:05 -07:00
2017-07-07 23:44:48 -07:00
Route::get('settings', ['as' => 'settings.general.index','uses' => 'SettingsController@getSettings' ]);
Route::post('settings', ['as' => 'settings.general.save','uses' => 'SettingsController@postSettings' ]);
2016-03-25 01:18:05 -07:00
2017-07-07 23:44:48 -07:00
Route::get('branding', ['as' => 'settings.branding.index','uses' => 'SettingsController@getBranding' ]);
Route::post('branding', ['as' => 'settings.branding.save','uses' => 'SettingsController@postBranding' ]);
2016-07-13 05:50:40 -07:00
2017-07-07 23:44:48 -07:00
Route::get('security', ['as' => 'settings.security.index','uses' => 'SettingsController@getSecurity' ]);
Route::post('security', ['as' => 'settings.security.save','uses' => 'SettingsController@postSecurity' ]);
2016-07-13 05:50:40 -07:00
2017-07-07 23:44:48 -07:00
Route::get('groups', ['as' => 'settings.groups.index','uses' => 'GroupsController@index' ]);
2016-03-25 01:18:05 -07:00
2017-07-07 23:44:48 -07:00
Route::get('localization', ['as' => 'settings.localization.index','uses' => 'SettingsController@getLocalization' ]);
Route::post('localization', ['as' => 'settings.localization.save','uses' => 'SettingsController@postLocalization' ]);
2016-07-13 05:50:40 -07:00
2017-07-07 23:44:48 -07:00
Route::get('notifications', ['as' => 'settings.alerts.index','uses' => 'SettingsController@getAlerts' ]);
Route::post('notifications', ['as' => 'settings.alerts.save','uses' => 'SettingsController@postAlerts' ]);
2016-07-13 05:50:40 -07:00
2017-07-07 23:44:48 -07:00
Route::get('slack', ['as' => 'settings.slack.index','uses' => 'SettingsController@getSlack' ]);
Route::post('slack', ['as' => 'settings.slack.save','uses' => 'SettingsController@postSlack' ]);
2016-03-25 01:18:05 -07:00
2017-07-07 23:44:48 -07:00
Route::get('asset_tags', ['as' => 'settings.asset_tags.index','uses' => 'SettingsController@getAssetTags' ]);
Route::post('asset_tags', ['as' => 'settings.asset_tags.save','uses' => 'SettingsController@postAssetTags' ]);
2016-03-25 01:18:05 -07:00
2017-07-07 23:44:48 -07:00
Route::get('barcodes', ['as' => 'settings.barcodes.index','uses' => 'SettingsController@getBarcodes' ]);
Route::post('barcodes', ['as' => 'settings.barcodes.save','uses' => 'SettingsController@postBarcodes' ]);
2016-03-25 01:18:05 -07:00
2017-07-07 23:44:48 -07:00
Route::get('labels', ['as' => 'settings.labels.index','uses' => 'SettingsController@getLabels' ]);
Route::post('labels', ['as' => 'settings.labels.save','uses' => 'SettingsController@postLabels' ]);
2016-03-25 01:18:05 -07:00
2017-07-07 23:44:48 -07:00
Route::get('ldap', ['as' => 'settings.ldap.index','uses' => 'SettingsController@getLdapSettings' ]);
Route::post('ldap', ['as' => 'settings.ldap.save','uses' => 'SettingsController@postLdapSettings' ]);
2016-07-13 05:50:40 -07:00
Route::get('phpinfo', ['as' => 'settings.phpinfo.index','uses' => 'SettingsController@getPhpInfo' ]);
2016-07-13 05:50:40 -07:00
2017-07-07 23:44:48 -07:00
Route::get('oauth', [ 'as' => 'settings.oauth.index', 'uses' => 'SettingsController@api' ]);
Route::get('purge', ['as' => 'settings.purge.index', 'uses' => 'SettingsController@getPurge']);
Route::post('purge', ['as' => 'settings.purge.save', 'uses' => 'SettingsController@postPurge']);
Route::get('login-attempts', ['as' => 'settings.logins.index','uses' => 'SettingsController@getLoginAttempts' ]);
2017-07-07 23:44:48 -07:00
# Backups
Route::group([ 'prefix' => 'backups', 'middleware' => 'auth' ], function () {
Route::get('download/{filename}', [
'as' => 'settings.backups.download',
'uses' => 'SettingsController@downloadFile' ]);
Route::delete('delete/{filename}', [
'as' => 'settings.backups.destroy',
'uses' => 'SettingsController@deleteFile' ]);
Route::post('/', [
'as' => 'settings.backups.create',
'uses' => 'SettingsController@postBackups'
]);
Route::get('/', [ 'as' => 'settings.backups.index', 'uses' => 'SettingsController@getBackups' ]);
2016-03-25 01:18:05 -07:00
});
2017-07-07 23:44:48 -07:00
2017-10-17 21:43:57 -07:00
Route::resource('groups', 'GroupsController', [
'middleware' => ['auth'],
'parameters' => ['group' => 'group_id']
]);
2017-07-07 23:44:48 -07:00
Route::get('/', ['as' => 'settings.index', 'uses' => 'SettingsController@index' ]);
2016-03-25 01:18:05 -07:00
});
2017-10-17 21:43:57 -07:00
Importer mapping - v1 (#3677) * Move importer to an inline-template, allows for translations and easier passing of data from laravel to vue. * Pull the modal out into a dedicated partial, move importer to views/importer. * Add document of CSV->importer mappings. Reorganize some code. Progress. * Add header_row and first_row to imports table, and process upon uploading a file * Use an expandable table row instead of a modal for import processing. This should allow for field mapping interaction easier. * Fix import processing after moving method. * Frontend importer mapping improvements. Invert display so we show found columns and allow users to select an importer field to map to. Also implement sample data based on first row of csv. * Update select2. Maintain selected items properly. * Backend support for importing. Only works on the web importer currently. Definitely needs testing and polish. * We no longer use vue-modal plugin. * Add a column to track field mappings to the imports table. * Cleanup/rename methods+refactor * Save field mappings and import type when attempting an import, and repopulate these values when returning to the page. * Update debugbar to fix a bug in the debugbar code. * Fix asset tag detection. Also rename findMatch to be a bit clearer as to what it does. Remove logging to file of imports for http imports because it eats an incredible amouint of memory. This commit also moves imports out of the hardware namespace and into their own webcontroller and route prefix, remove dead code from AssetController as a result. * Dynamically limit options for select2 based on import type selected, and group them by item type. * Add user importer. Still need to implement emailing of passwords to new users, and probably test a bit more. This also bumps the memory limit for web imports up as well, I need to profile memory usage here before too long. * Query the db to find user matches rather than search the array. Performance is much much better. * Speed/memory improvements in importers. Move to querying the db rather than maintaining an array for all importers. Also only store the id of items when we import, rather than the full model. It saves a decent amount of memory. * Remove grouping of items in select2 With the values being set dynamically, the grouping is redundant. It also caused a regression with automatically guessing/matching field names. This is starting to get close. * Remove debug line on every create. * Switch migration to be text field instead of json field for compatibility with older mysql/mariadb * Fix asset import regression matching email address. * Rearrange travis order in attempt to fix null settings. * Use auth::id instead of fetching it off the user. Fixes a null object reference during seeding.
2017-06-21 16:37:37 -07:00
/*
|--------------------------------------------------------------------------
| Importer Routes
|--------------------------------------------------------------------------
|
|
|
*/
Route::group([ 'prefix' => 'import', 'middleware' => ['auth']], function () {
Route::get('/', [
'as' => 'imports.index',
'uses' => 'ImportsController@index'
]);
});
2016-03-25 01:18:05 -07:00
/*
|--------------------------------------------------------------------------
| Account Routes
|--------------------------------------------------------------------------
|
|
|
*/
Route::group([ 'prefix' => 'account', 'middleware' => ['auth']], function () {
2016-03-25 01:18:05 -07:00
# Profile
Route::get('profile', [ 'as' => 'profile', 'uses' => 'ProfileController@getIndex' ]);
Route::post('profile', 'ProfileController@postIndex');
2017-10-25 20:15:30 -07:00
Route::get('menu', [ 'as' => 'account.menuprefs', 'uses' => 'ProfileController@getMenuState' ]);
Route::get('password', [ 'as' => 'account.password.index', 'uses' => 'ProfileController@password' ]);
Route::post('password', [ 'uses' => 'ProfileController@passwordSave' ]);
Route::get('api', [ 'as' => 'user.api', 'uses' => 'ProfileController@api' ]);
2017-01-11 03:38:55 -08:00
2016-03-25 01:18:05 -07:00
# View Assets
Route::get('view-assets', [ 'as' => 'view-assets', 'uses' => 'ViewAssetsController@getIndex' ]);
WIP - Improved requested assets (#5289) * WIP - beginning of improved requested assets - Use Ajax tables for faster loading - Use new notifications for requesting an asset TODO: - Use ajax tables for requestable asset models - Use new notifications for canceling an asset request - Expire requests once the asset has been checked out to the requesting user * Only show asset name in email if it has one * Refactor requested method to only include non-canceled requests * Refactored requestable assets to log request and cancelation * Added softdeletes on checkout requests * Differentiate between canceling and deleting requests * Added asset request cancelation notification * Added timestamps and corrected unique key on requests table * Improved requests view * Re-use blade for cancel/request email * Refactored BS table formatter for requested assets * Location name min reduced to 2 * Added PAT test as maintenance option This needs to be refactored into database-driven options with a UI * Better slack message * Added getImageUrl method for assets * Include qty in request notifications TODO: - Try to pull requested info from original request for cancelation, otherwise it will default to 1 * Removed old asset request/cancel emails * Added user profile asset request routes * Added profile controller requested assets method * Added blade link to requested assets for profile view * Sort user history desc * Added requested assets blade * Added canceled at to checkoutRequest method * Include qty in request * Fixed comment, removed allowed_columns * Removed Queable methods, since we don’t use a queue * Fixed return type in method doc * Fixed version number * Changed id to user_id for clarity
2018-04-04 17:33:02 -07:00
Route::get('requested', [ 'as' => 'account.requested', 'uses' => 'ViewAssetsController@getRequestedAssets' ]);
2016-03-25 01:18:05 -07:00
# Accept Asset
Route::get(
'accept-asset/{logID}',
[ 'as' => 'account/accept-assets', 'uses' => 'ViewAssetsController@getAcceptAsset' ]
);
Route::post(
'accept-asset/{logID}',
[ 'as' => 'account/asset-accepted', 'uses' => 'ViewAssetsController@postAcceptAsset' ]
);
# Profile
Route::get(
'requestable-assets',
[ 'as' => 'requestable-assets', 'uses' => 'ViewAssetsController@getRequestableIndex' ]
);
Route::get(
'request-asset/{assetId}',
[ 'as' => 'account/request-asset', 'uses' => 'ViewAssetsController@getRequestAsset' ]
);
Route::post(
'request/{itemType}/{itemId}',
[ 'as' => 'account/request-item', 'uses' => 'ViewAssetsController@getRequestItem']
);
2016-03-25 01:18:05 -07:00
# Account Dashboard
2016-06-10 08:29:43 -07:00
Route::get('/', [ 'as' => 'account', 'uses' => 'ViewAssetsController@getIndex' ]);
2016-03-25 01:18:05 -07:00
});
Route::group(['middleware' => ['auth']], function () {
2016-03-25 01:18:05 -07:00
Route::get('reports/audit', [
'as' => 'reports.audit',
'uses' => 'ReportsController@audit'
]);
2016-03-25 01:18:05 -07:00
Route::get(
'reports/depreciation',
[ 'as' => 'reports/depreciation', 'uses' => 'ReportsController@getDeprecationReport' ]
);
Route::get(
'reports/export/depreciation',
[ 'as' => 'reports/export/depreciation', 'uses' => 'ReportsController@exportDeprecationReport' ]
);
Route::get(
'reports/asset_maintenances',
[ 'as' => 'reports/asset_maintenances', 'uses' => 'ReportsController@getAssetMaintenancesReport' ]
);
Route::get(
'reports/export/asset_maintenances',
[
'as' => 'reports/export/asset_maintenances',
'uses' => 'ReportsController@exportAssetMaintenancesReport'
]
);
Route::get(
'reports/licenses',
[ 'as' => 'reports/licenses', 'uses' => 'ReportsController@getLicenseReport' ]
);
Route::get(
'reports/export/licenses',
[ 'as' => 'reports/export/licenses', 'uses' => 'ReportsController@exportLicenseReport' ]
);
2018-05-02 14:13:06 -07:00
2016-03-25 01:18:05 -07:00
Route::get('reports/accessories', [ 'as' => 'reports/accessories', 'uses' => 'ReportsController@getAccessoryReport' ]);
Route::get(
'reports/export/accessories',
[ 'as' => 'reports/export/accessories', 'uses' => 'ReportsController@exportAccessoryReport' ]
);
Route::get('reports/custom', [ 'as' => 'reports/custom', 'uses' => 'ReportsController@getCustomReport' ]);
Route::post('reports/custom', 'ReportsController@postCustom');
Route::get(
'reports/activity',
[ 'as' => 'reports.activity', 'uses' => 'ReportsController@getActivityReport' ]
2016-03-25 01:18:05 -07:00
);
2016-09-19 23:52:01 -07:00
2016-03-25 01:18:05 -07:00
Route::get(
'reports/unaccepted_assets',
[ 'as' => 'reports/unaccepted_assets', 'uses' => 'ReportsController@getAssetAcceptanceReport' ]
);
Route::get(
'reports/export/unaccepted_assets',
[ 'as' => 'reports/export/unaccepted_assets', 'uses' => 'ReportsController@exportAssetAcceptanceReport' ]
);
});
2017-02-02 18:14:25 -08:00
Route::get(
'auth/signin',
['uses' => 'Auth\LoginController@legacyAuthRedirect' ]
);
2016-03-25 01:18:05 -07:00
/*
|--------------------------------------------------------------------------
| Setup Routes
|--------------------------------------------------------------------------
|
|
|
*/
2016-05-14 17:25:56 -07:00
Route::group([ 'prefix' => 'setup', 'middleware' => 'web'], function () {
2016-03-25 01:18:05 -07:00
Route::get(
'user',
[
'as' => 'setup.user',
'uses' => 'SettingsController@getSetupUser' ]
);
Route::post(
'user',
[
'as' => 'setup.user.save',
'uses' => 'SettingsController@postSaveFirstAdmin' ]
);
Route::get(
'migrate',
[
'as' => 'setup.migrate',
'uses' => 'SettingsController@getSetupMigrate' ]
);
Route::get(
'done',
[
'as' => 'setup.done',
'uses' => 'SettingsController@getSetupDone' ]
);
Route::get(
'mailtest',
[
'as' => 'setup.mailtest',
'uses' => 'SettingsController@ajaxTestEmail' ]
);
Route::get(
'/',
[
'as' => 'setup',
'uses' => 'SettingsController@getSetupIndex' ]
);
});
Route::get(
'two-factor-enroll',
[
'as' => 'two-factor-enroll',
'middleware' => ['web'],
'uses' => 'Auth\LoginController@getTwoFactorEnroll' ]
);
Route::get(
'two-factor',
[
'as' => 'two-factor',
'middleware' => ['web'],
'uses' => 'Auth\LoginController@getTwoFactorAuth' ]
);
Route::post(
'two-factor',
[
'as' => 'two-factor',
'middleware' => ['web'],
'uses' => 'Auth\LoginController@postTwoFactorAuth' ]
);
2016-03-25 01:18:05 -07:00
Route::get(
'/',
[
'as' => 'home',
'middleware' => ['auth'],
2016-03-25 01:18:05 -07:00
'uses' => 'DashboardController@getIndex' ]
);
2016-03-25 01:18:05 -07:00
Route::group(['middleware' => 'web'], function () {
//Route::auth();
Route::get(
'login',
[
'as' => 'login',
'middleware' => ['web'],
'uses' => 'Auth\LoginController@showLoginForm' ]
);
Route::post(
'login',
[
'as' => 'login',
'middleware' => ['web'],
'uses' => 'Auth\LoginController@login' ]
);
Route::get(
'logout',
[
'as' => 'logout',
'uses' => 'Auth\LoginController@logout' ]
);
2016-03-25 01:18:05 -07:00
});
Auth::routes();
2017-05-09 00:37:37 -07:00
2017-05-23 09:24:53 -07:00
2017-05-09 00:37:37 -07:00