Compare commits
1 Commits
3aa5e05947
...
6ebf588b1f
Author | SHA1 | Date | |
---|---|---|---|
6ebf588b1f |
@ -214,7 +214,7 @@ final class Server
|
|||||||
* @throws ObjectNotFoundException
|
* @throws ObjectNotFoundException
|
||||||
* @testedin TranslateOidTest::testRootDSE();
|
* @testedin TranslateOidTest::testRootDSE();
|
||||||
*/
|
*/
|
||||||
public static function rootDSE(?string $connection=NULL,?Carbon $cachetime=NULL): ?Model
|
public static function rootDSE(?string $connection=NULL,Carbon $cachetime=NULL): ?Model
|
||||||
{
|
{
|
||||||
$e = new Entry;
|
$e = new Entry;
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Middleware;
|
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Cookie;
|
|
||||||
|
|
||||||
class AllowAnonymous
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Handle an incoming request.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
|
||||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
|
||||||
*/
|
|
||||||
public function handle(Request $request,Closure $next): mixed
|
|
||||||
{
|
|
||||||
if (((! Cookie::has('username_encrypt')) || (! Cookie::has('password_encrypt'))) && (! config('pla.allow_guest',FALSE)))
|
|
||||||
return redirect()
|
|
||||||
->to('/login');
|
|
||||||
|
|
||||||
return $next($request);
|
|
||||||
}
|
|
||||||
}
|
|
@ -40,10 +40,10 @@ class SwapinAuthUser
|
|||||||
Config::set('ldap.connections.'.$key.'.password',Cookie::get('password_encrypt'));
|
Config::set('ldap.connections.'.$key.'.password',Cookie::get('password_encrypt'));
|
||||||
|
|
||||||
Log::debug('Swapping out configured LDAP credentials with the user\'s cookie.',['key'=>$key,'user'=>Cookie::get('username_encrypt')]);
|
Log::debug('Swapping out configured LDAP credentials with the user\'s cookie.',['key'=>$key,'user'=>Cookie::get('username_encrypt')]);
|
||||||
}
|
|
||||||
|
|
||||||
// We need to override our Connection object so that we can store and retrieve the logged in user and swap out the credentials to use them.
|
// We need to override our Connection object so that we can store and retrieve the logged in user and swap out the credentials to use them.
|
||||||
Container::getInstance()->addConnection(new Connection(config('ldap.connections.'.$key)),$key);
|
Container::getInstance()->addConnection(new Connection(config('ldap.connections.'.$key)),$key);
|
||||||
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,10 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
$this->loadViewsFrom(__DIR__.'/../../resources/themes/architect/views/','architect');
|
$this->loadViewsFrom(__DIR__.'/../../resources/themes/architect/views/','architect');
|
||||||
|
|
||||||
// Enable pluck on collections to work on private values
|
// Enable pluck on collections to work on private values
|
||||||
Collection::macro('ppluck',
|
Collection::macro('ppluck', function ($attr) {
|
||||||
fn($attr)=>$this
|
return $this->map(function (object $item) use ($attr) {
|
||||||
->map(fn($item)=>$item->{$attr})
|
return $item->{$attr};
|
||||||
->values());
|
})->values();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ use Illuminate\Foundation\Application;
|
|||||||
use Illuminate\Foundation\Configuration\Exceptions;
|
use Illuminate\Foundation\Configuration\Exceptions;
|
||||||
use Illuminate\Foundation\Configuration\Middleware;
|
use Illuminate\Foundation\Configuration\Middleware;
|
||||||
|
|
||||||
use App\Http\Middleware\{AllowAnonymous,ApplicationSession,CheckUpdate,SwapinAuthUser};
|
use App\Http\Middleware\{ApplicationSession,CheckUpdate,SwapinAuthUser};
|
||||||
|
|
||||||
return Application::configure(basePath: dirname(__DIR__))
|
return Application::configure(basePath: dirname(__DIR__))
|
||||||
->withRouting(
|
->withRouting(
|
||||||
@ -16,16 +16,15 @@ return Application::configure(basePath: dirname(__DIR__))
|
|||||||
)
|
)
|
||||||
->withMiddleware(function (Middleware $middleware) {
|
->withMiddleware(function (Middleware $middleware) {
|
||||||
$middleware->appendToGroup('web', [
|
$middleware->appendToGroup('web', [
|
||||||
ApplicationSession::class,
|
|
||||||
SwapinAuthUser::class,
|
SwapinAuthUser::class,
|
||||||
|
ApplicationSession::class,
|
||||||
CheckUpdate::class,
|
CheckUpdate::class,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$middleware->prependToGroup('api', [
|
$middleware->prependToGroup('api', [
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
ApplicationSession::class,
|
|
||||||
SwapinAuthUser::class,
|
SwapinAuthUser::class,
|
||||||
AllowAnonymous::class,
|
ApplicationSession::class,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$middleware->trustProxies(at: [
|
$middleware->trustProxies(at: [
|
||||||
|
@ -31,18 +31,6 @@ return [
|
|||||||
],
|
],
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Allow Guest
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This will determine whether a user can connect to PLA and show the tree
|
|
||||||
| before they have logged in.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'allow_guest' => env('LDAP_ALLOW_GUEST',FALSE),
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Custom Date Format
|
| Custom Date Format
|
||||||
|
@ -15,9 +15,12 @@ use App\Http\Controllers\APIController;
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Route::controller(APIController::class)->group(function() {
|
Route::group([],function() {
|
||||||
Route::get('bases','bases');
|
Route::get('bases',[APIController::class,'bases']);
|
||||||
Route::get('children','children');
|
Route::get('children',[APIController::class,'children']);
|
||||||
Route::post('schema/view','schema_view');
|
Route::post('schema/view',[APIController::class,'schema_view']);
|
||||||
Route::post('schema/objectclass/attrs/{id}','schema_objectclass_attrs');
|
Route::post('schema/objectclass/attrs/{id}',[APIController::class,'schema_objectclass_attrs']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::group(['middleware'=>'auth:api','prefix'=>'user'],function() {
|
||||||
|
});
|
||||||
|
18
routes/channels.php
Normal file
18
routes/channels.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Broadcast Channels
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may register all of the event broadcasting channels that your
|
||||||
|
| application supports. The given channel authorization callbacks are
|
||||||
|
| used to check if an authenticated user can listen to the channel.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Broadcast::channel('App.User.{id}', function ($user, $id) {
|
||||||
|
return (int) $user->id === (int) $id;
|
||||||
|
});
|
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
use App\Http\Controllers\HomeController;
|
use App\Http\Controllers\{HomeController,ImportController};
|
||||||
use App\Http\Controllers\Auth\LoginController;
|
use App\Http\Controllers\Auth\LoginController;
|
||||||
use App\Http\Middleware\AllowAnonymous;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -26,29 +25,25 @@ Auth::routes([
|
|||||||
'register' => FALSE,
|
'register' => FALSE,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Route::get('/',[HomeController::class,'home']);
|
||||||
|
Route::get('info',[HomeController::class,'info']);
|
||||||
|
Route::post('dn',[HomeController::class,'dn_frame']);
|
||||||
|
Route::get('debug',[HomeController::class,'debug']);
|
||||||
|
Route::get('import',[HomeController::class,'import_frame']);
|
||||||
|
Route::get('schema',[HomeController::class,'schema_frame']);
|
||||||
|
|
||||||
Route::get('logout',[LoginController::class,'logout']);
|
Route::get('logout',[LoginController::class,'logout']);
|
||||||
|
|
||||||
Route::controller(HomeController::class)->group(function() {
|
Route::group(['prefix'=>'user'],function() {
|
||||||
Route::middleware(AllowAnonymous::class)->group(function() {
|
Route::get('image',[HomeController::class,'user_image']);
|
||||||
Route::get('/','home');
|
});
|
||||||
Route::get('info','info');
|
|
||||||
Route::post('dn','dn_frame');
|
|
||||||
Route::get('debug','debug');
|
|
||||||
Route::get('import','import_frame');
|
|
||||||
Route::get('schema','schema_frame');
|
|
||||||
|
|
||||||
Route::group(['prefix'=>'user'],function() {
|
Route::post('entry/add',[HomeController::class,'entry_add']);
|
||||||
Route::get('image','user_image');
|
Route::get('entry/export/{id}',[HomeController::class,'entry_export']);
|
||||||
});
|
Route::post('entry/password/check/',[HomeController::class,'entry_password_check']);
|
||||||
|
Route::post('entry/attr/add/{id}',[HomeController::class,'entry_attr_add']);
|
||||||
|
Route::post('entry/objectclass/add/{id}',[HomeController::class,'entry_objectclass_add']);
|
||||||
|
Route::post('entry/update/commit',[HomeController::class,'entry_update']);
|
||||||
|
Route::post('entry/update/pending',[HomeController::class,'entry_pending_update']);
|
||||||
|
|
||||||
Route::post('entry/add','entry_add');
|
Route::post('import/process/{type}',[HomeController::class,'import']);
|
||||||
Route::get('entry/export/{id}','entry_export');
|
|
||||||
Route::post('entry/password/check/','entry_password_check');
|
|
||||||
Route::post('entry/attr/add/{id}','entry_attr_add');
|
|
||||||
Route::post('entry/objectclass/add/{id}','entry_objectclass_add');
|
|
||||||
Route::post('entry/update/commit','entry_update');
|
|
||||||
Route::post('entry/update/pending','entry_pending_update');
|
|
||||||
|
|
||||||
Route::post('import/process/{type}','import');
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user