Skip to content

Commit

Permalink
Merge pull request #1 from dimer47/feat/allow_unauthenticated_access
Browse files Browse the repository at this point in the history
Allow unauthenticated access to logger activity screens
  • Loading branch information
dimer47 authored Jul 26, 2022
2 parents 5d230c1 + c63bc9f commit 115afd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/App/Http/Controllers/LaravelLoggerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class LaravelLoggerController extends BaseController
*/
public function __construct()
{
$this->middleware('auth');
$this->_authRequired = config('LaravelLogger.authRequired');
if ($this->_authRequired) {
$this->middleware('auth');
}

$this->_rolesEnabled = config('LaravelLogger.rolesEnabled');
$this->_rolesMiddlware = config('LaravelLogger.rolesMiddlware');
Expand Down
9 changes: 8 additions & 1 deletion src/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
|
*/

Route::group(['prefix' => 'activity', 'namespace' => 'jeremykenedy\LaravelLogger\App\Http\Controllers', 'middleware' => ['web', 'auth', 'activity']], function () {
Route::group(['prefix' => 'activity', 'namespace' => 'jeremykenedy\LaravelLogger\App\Http\Controllers', 'middleware' => (function () {
$middleware = ['web', 'activity'];

if (config('LaravelLogger.authRequired', true)) {
$middleware[] = 'auth';
}

return $middleware;
})], function () {
// Dashboards
Route::get('/', 'LaravelLoggerController@showAccessLog')->name('activity');
Route::get('/cleared', ['uses' => 'LaravelLoggerController@showClearedActivityLog'])->name('cleared');
Expand Down

0 comments on commit 115afd2

Please sign in to comment.