Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,12 @@
"psr-4": {
"VIACreative\\SudoSu\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"VIACreative\\SudoSu\\ServiceProvider"
]
}
}
}
18 changes: 14 additions & 4 deletions config/sudosu.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| .local, simply add it to the arrow below.
|
*/

'allowed_tlds' => ['dev', 'local'],

/*
Expand All @@ -26,7 +26,17 @@
| displayed in the select dropdown. This must be an Eloquent Model instance.
|
*/

'user_model' => App\User::class


'user_model' => App\User::class,

/*
|--------------------------------------------------------------------------
| Middleware for sudosu
|--------------------------------------------------------------------------
|
| Define the middleware for sudosu, eg. ['web', 'can:sudoer'] means the cross
| login user must have the sudoer permission or role.
|
*/
'middleware' => ['web',],
];
4 changes: 2 additions & 2 deletions resources/views/user-selector.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="{{config('sudosu.font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css')}}">
<link rel="stylesheet" href="/sudo-su/css/app.css">

<div class="sudoSu">
Expand Down Expand Up @@ -45,4 +45,4 @@
const element = document.getElementById('sudosu-js-interface');

btn.addEventListener('click', event => element.classList.toggle('hidden'));
</script>
</script>
2 changes: 1 addition & 1 deletion src/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function map()
Route::group([
'prefix' => 'sudosu',
'namespace' => 'VIACreative\SudoSu\Controllers',
'middleware' => ['web']
'middleware' => config('sudosu.middleware', ['web']),
], function () {
Route::post('/sudosu/login-as-user', 'SudoSuController@loginAsUser')
->name('sudosu.login_as_user');
Expand Down
7 changes: 5 additions & 2 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function boot()
$this->registerViews();
}
}

protected function registerViews()
{
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'sudosu');
Expand All @@ -47,11 +47,14 @@ protected function registerViews()
'originalUser' => $sudosu->getOriginalUser(),
'currentUser' => Auth::user()
]);
});
});
}

protected function tldIsAllowed()
{
if (false === Config::get('sudosu.check_tlds')) {
return true;
}
$requestTld = $this->getRequestTld();
$allowedTlds = Config::get('sudosu.allowed_tlds');

Expand Down