athenahr/routes/web.php

342 lines
14 KiB
PHP
Raw Normal View History

2020-04-26 05:09:32 +01:00
<?php
2020-10-10 16:30:26 +00:00
/*
* Copyright © 2020 Miguel Nogueira
*
* This file is part of Raspberry Staff Manager.
*
* Raspberry Staff Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Raspberry Staff Manager is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Raspberry Staff Manager. If not, see <https://www.gnu.org/licenses/>.
*/
2020-10-08 23:47:23 +01:00
use App\Http\Controllers\ApplicationController;
use App\Http\Controllers\AppointmentController;
2021-12-19 03:43:30 +00:00
use App\Http\Controllers\Auth\LoginController;
2020-10-08 23:47:23 +01:00
use App\Http\Controllers\Auth\TwofaController;
use App\Http\Controllers\BanController;
use App\Http\Controllers\CommentController;
use App\Http\Controllers\ContactController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\DevToolsController;
use App\Http\Controllers\FormController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\TeamController;
use App\Http\Controllers\TeamFileController;
2020-10-08 23:47:23 +01:00
use App\Http\Controllers\UserController;
use App\Http\Controllers\VacancyController;
use App\Http\Controllers\VoteController;
2020-12-08 02:58:10 +00:00
use App\Http\Controllers\OptionsController;
2021-01-06 00:57:27 +00:00
use App\Http\Controllers\SecuritySettingsController;
2021-10-28 23:57:58 +01:00
use Illuminate\Support\Facades\Log;
2020-04-26 05:09:32 +01:00
use Illuminate\Support\Facades\Route;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
2020-04-26 05:09:32 +01:00
2020-04-26 05:09:32 +01:00
/*
|--------------------------------------------------------------------------
| 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!
|
*/
2021-10-28 23:57:58 +01:00
Route::get('/uptime', function () {
return response()->json([
'app' => config('app.name'),
'status' => 'up',
'version' => '0.7.2',
'meta' => [
'demo_enabled' => config('demo.is_enabled'),
]
]);
})->name('uptime');
2020-10-10 16:30:26 +00:00
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath']], function () {
Route::group(['prefix' => 'auth', 'middleware' => ['usernameUUID']], function () {
Auth::routes([
'verify' => true
]);
2020-07-17 22:44:10 +01:00
2020-10-08 23:47:23 +01:00
Route::post('/twofa/authenticate', [TwofaController::class, 'verify2FA'])
->name('verify2FA');
2021-12-19 03:43:30 +00:00
Route::get('/auth/redirect/discord', [LoginController::class, 'discordRedirect'])
->name('discordRedirect');
Route::get('/auth/callback/discord', [LoginController::class, 'discordCallback'])
->name('discordCallback');
});
2020-10-08 23:47:23 +01:00
Route::get('/', [HomeController::class, 'index'])
2021-12-09 21:46:25 +00:00
->name('home')
->middleware('eligibility');
2021-12-09 21:22:40 +00:00
2020-10-08 23:47:23 +01:00
Route::post('/form/contact', [ContactController::class, 'create'])
->name('sendSubmission');
2020-10-08 23:47:23 +01:00
Route::get('/accounts/danger-zone/{ID}/{action}/{token}', [UserController::class, 'processDeleteConfirmation'])
->name('processDeleteConfirmation');
Route::group(['middleware' => ['auth', 'forcelogout', 'passwordexpiration', '2fa', 'verified']], function () {
2021-03-30 01:27:49 +01:00
Route::group(['middleware' => ['passwordredirect']], function(){
2021-03-30 01:27:49 +01:00
Route::get('/dashboard', [DashboardController::class, 'index'])
->name('dashboard')
->middleware('eligibility');
Route::get('users/directory', [ProfileController::class, 'index'])
->name('directory');
Route::resource('teams', TeamController::class);
2020-10-03 21:36:35 +01:00
Route::post('teams/{team}/invites/send', [TeamController::class, 'invite'])
->name('sendInvite');
2020-10-03 21:36:35 +01:00
Route::get('teams/{team}/switch', [TeamController::class, 'switchTeam'])
->name('switchTeam');
Route::patch('teams/{team}/vacancies/update', [TeamController::class, 'assignVacancies'])
->name('assignVacancies');
Route::get('teams/invites/{action}/{token}', [TeamController::class, 'processInviteAction'])
->name('processInvite');
2020-11-02 21:44:05 +00:00
Route::get('team/files', [TeamFileController::class, 'index'])
->name('showTeamFiles');
2020-11-02 21:44:05 +00:00
Route::post('team/files/upload', [TeamFileController::class, 'store'])
->name('uploadTeamFile');
Route::delete('team/files/{teamFile}/delete', [TeamFileController::class, 'destroy'])
->name('deleteTeamFile');
Route::get('team/files/{teamFile}/download', [TeamFileController::class, 'download'])
->name('downloadTeamFile');
2021-03-30 01:27:49 +01:00
});
2020-11-02 21:44:05 +00:00
Route::group(['prefix' => '/applications', 'middleware' => ['passwordredirect']], function () {
2020-10-08 23:47:23 +01:00
Route::get('/my-applications', [ApplicationController::class, 'showUserApps'])
->name('showUserApps')
->middleware('eligibility');
2020-10-08 23:47:23 +01:00
Route::get('/view/{application}', [ApplicationController::class, 'showUserApp'])
->name('showUserApp');
2020-10-08 23:47:23 +01:00
Route::post('/{application}/comments', [CommentController::class, 'insert'])
->name('addApplicationComment');
2020-10-08 23:47:23 +01:00
Route::delete('/comments/{comment}/delete', [CommentController::class, 'delete'])
->name('deleteApplicationComment');
2020-10-08 23:47:23 +01:00
Route::patch('/notes/save/{application}', [AppointmentController::class, 'saveNotes'])
->name('saveNotes');
2020-10-08 23:47:23 +01:00
Route::patch('/update/{application}/{newStatus}', [ApplicationController::class, 'updateApplicationStatus'])
->name('updateApplicationStatus');
2020-10-08 23:47:23 +01:00
Route::delete('{application}/delete', [ApplicationController::class, 'delete'])
->name('deleteApplication');
2020-07-11 02:43:59 +01:00
2020-10-08 23:47:23 +01:00
Route::get('/staff/all', [ApplicationController::class, 'showAllApps'])
->name('allApplications');
2020-07-11 02:43:59 +01:00
2020-10-08 23:47:23 +01:00
Route::post('{application}/staff/vote', [VoteController::class, 'vote'])
->name('voteApplication');
});
Route::group(['prefix' => 'appointments', 'middleware' => ['passwordredirect']], function () {
2020-10-08 23:47:23 +01:00
Route::post('schedule/appointments/{application}', [AppointmentController::class, 'saveAppointment'])
->name('scheduleAppointment');
2020-10-08 23:47:23 +01:00
Route::patch('update/appointments/{application}/{status}', [AppointmentController::class, 'updateAppointment'])
->name('updateAppointment');
Route::delete('delete/appointments/{application}', [AppointmentController::class, 'deleteAppointment'])
->name('deleteAppointment');
});
Route::group(['prefix' => 'apply', 'middleware' => ['eligibility', 'passwordredirect']], function () {
2020-10-08 23:47:23 +01:00
Route::get('positions/{vacancySlug}', [ApplicationController::class, 'renderApplicationForm'])
->name('renderApplicationForm');
2020-10-08 23:47:23 +01:00
Route::post('positions/{vacancySlug}/submit', [ApplicationController::class, 'saveApplicationAnswers'])
->name('saveApplicationForm');
});
// Further locking down the profile section by adding the middleware to everything but the required routes
2020-10-10 16:30:26 +00:00
Route::group(['prefix' => '/profile'], function () {
2020-10-08 23:47:23 +01:00
Route::get('/settings', [ProfileController::class, 'showProfile'])
->name('showProfileSettings')
->middleware('passwordredirect');
2020-10-08 23:47:23 +01:00
Route::patch('/settings/save', [ProfileController::class, 'saveProfile'])
->name('saveProfileSettings')
->middleware('passwordredirect');
2020-10-08 23:47:23 +01:00
Route::get('user/{user}', [ProfileController::class, 'showSingleProfile'])
->name('showSingleProfile')
->middleware('passwordredirect');
2020-10-08 23:47:23 +01:00
Route::get('/settings/account', [UserController::class, 'showAccount'])
->name('showAccountSettings');
2021-01-06 00:57:27 +00:00
2020-10-08 23:47:23 +01:00
Route::patch('/settings/account/change-password', [UserController::class, 'changePassword'])
->name('changePassword');
2020-10-08 23:47:23 +01:00
Route::patch('/settings/account/change-email', [UserController::class, 'changeEmail'])
->name('changeEmail')
->middleware('passwordredirect');
2020-10-08 23:47:23 +01:00
Route::post('/settings/account/flush-sessions', [UserController::class, 'flushSessions'])
->name('flushSessions')
->middleware('passwordredirect');
2020-07-17 22:44:10 +01:00
2020-10-08 23:47:23 +01:00
Route::patch('/settings/account/twofa/enable', [UserController::class, 'add2FASecret'])
->name('enable2FA')
->middleware('passwordredirect');
2020-07-17 22:44:10 +01:00
2020-10-08 23:47:23 +01:00
Route::patch('/settings/account/twofa/disable', [UserController::class, 'remove2FASecret'])
->name('disable2FA')
->middleware('passwordredirect');
2020-10-08 23:47:23 +01:00
Route::patch('/settings/account/dg/delete', [UserController::class, 'userDelete'])
->name('userDelete')
->middleware('passwordredirect');
});
Route::group(['prefix' => '/hr', 'middleware' => ['passwordredirect']], function () {
2022-02-02 05:36:09 +00:00
Route::get('users', [UserController::class, 'showUsers'])
->name('registeredPlayerList');
2020-10-08 23:47:23 +01:00
Route::post('players/search', [UserController::class, 'showPlayersLike'])
->name('searchRegisteredPLayerList');
2020-10-08 23:47:23 +01:00
Route::patch('staff-members/terminate/{user}', [UserController::class, 'terminate'])
->name('terminateStaffMember');
2022-02-07 18:59:22 +00:00
Route::resource('absences', \App\Http\Controllers\AbsenceController::class);
});
2020-05-03 05:04:26 +01:00
Route::group(['prefix' => 'admin', 'middleware' => ['passwordredirect']], function () {
2020-10-08 23:47:23 +01:00
Route::get('settings', [OptionsController::class, 'index'])
->name('showSettings');
2020-08-30 23:06:01 +01:00
2021-03-31 03:55:09 +01:00
Route::patch('keys/revoke/{key}', [ApiKeyController::class, 'revokeKey'])
->name('revokeKey');
2021-03-30 18:16:01 +01:00
2020-10-08 23:47:23 +01:00
Route::post('settings/save', [OptionsController::class, 'saveSettings'])
->name('saveSettings');
2021-01-06 00:57:27 +00:00
Route::post('settings/security/save', [SecuritySettingsController::class, 'save'])
->name('saveSecuritySettings');
2021-01-06 01:55:22 +00:00
Route::patch('settings/game/update', [OptionsController::class, 'saveGameIntegration'])
->name('saveGameIntegration');
2020-10-08 23:47:23 +01:00
Route::post('players/ban/{user}', [BanController::class, 'insert'])
->name('banUser');
2020-10-08 23:47:23 +01:00
Route::delete('players/unban/{user}', [BanController::class, 'delete'])
->name('unbanUser');
2020-10-08 23:47:23 +01:00
Route::delete('players/delete/{user}', [UserController::class, 'delete'])
->name('deleteUser');
2020-10-08 23:47:23 +01:00
Route::patch('players/update/{user}', [UserController::class, 'update'])
->name('updateUser');
2020-10-08 23:47:23 +01:00
Route::get('positions', [VacancyController::class, 'index'])
->name('showPositions');
2020-10-08 23:47:23 +01:00
Route::post('positions/save', [VacancyController::class, 'store'])
->name('savePosition');
2020-10-08 23:47:23 +01:00
Route::get('positions/edit/{vacancy}', [VacancyController::class, 'edit'])
->name('editPosition');
2020-07-11 20:34:26 +01:00
2020-10-08 23:47:23 +01:00
Route::patch('positions/update/{vacancy}', [VacancyController::class, 'update'])
->name('updatePosition');
2020-07-11 20:34:26 +01:00
2021-10-25 05:45:45 +01:00
Route::delete('positions/delete/{vacancy}', [VacancyController::class, 'delete'])
->name('deletePosition');
2020-10-08 23:47:23 +01:00
Route::patch('positions/availability/{status}/{vacancy}', [VacancyController::class, 'updatePositionAvailability'])
->name('updatePositionAvailability');
2020-05-03 05:04:26 +01:00
2020-10-08 23:47:23 +01:00
Route::get('forms/builder', [FormController::class, 'showFormBuilder'])
->name('showFormBuilder');
2020-05-03 05:04:26 +01:00
2020-10-08 23:47:23 +01:00
Route::post('forms/save', [FormController::class, 'saveForm'])
->name('saveForm');
2020-05-07 00:36:33 +01:00
2020-10-08 23:47:23 +01:00
Route::delete('forms/destroy/{form}', [FormController::class, 'destroy'])
->name('destroyForm');
Route::get('forms', [FormController::class, 'index'])
->name('showForms');
2020-10-08 23:47:23 +01:00
Route::get('forms/preview/{form}', [FormController::class, 'preview'])
->name('previewForm');
2020-10-08 23:47:23 +01:00
Route::get('forms/edit/{form}', [FormController::class, 'edit'])
->name('editForm');
2020-10-08 23:47:23 +01:00
Route::patch('forms/update/{form}', [FormController::class, 'update'])
->name('updateForm');
Route::group(['prefix' => 'devtools'], function () {
Route::get('/', [DevToolsController::class, 'index'])
->name('devTools');
Route::post('/applications/force-approval', [DevToolsController::class, 'forceApprovalEvent'])
->name('devForceApprovalEvent');
Route::post('/applications/force-rejection', [DevToolsController::class, 'forceRejectionEvent'])
->name('devForceRejectionEvent');
Route::post('/applications/count-votes', [DevToolsController::class, 'evaluateVotes'])
->name('devForceEvaluateVotes');
Route::delete('/suspensions/purge-expired', [DevToolsController::class, 'purgeSuspensions'])
->name('devPurgeExpired');
});
});
});
});