Start of a debug screen
This commit is contained in:
parent
58e171aea1
commit
e0185345c8
@ -2,11 +2,12 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|
@ -8,13 +8,23 @@ use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use LdapRecord\Models\ModelNotFoundException;
|
||||
|
||||
use App\Ldap\Entry;
|
||||
use App\Classes\LDAP\Server;
|
||||
use LdapRecord\Models\ModelNotFoundException;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Debug Page
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function debug()
|
||||
{
|
||||
return view('debug');
|
||||
}
|
||||
|
||||
/**
|
||||
* Application home page
|
||||
*/
|
||||
|
@ -5,8 +5,7 @@ namespace App\Ldap;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use LdapRecord\Models\Model;
|
||||
use LdapRecord\Models\ModelNotFoundException;
|
||||
use LdapRecord\Query\Model\Builder;
|
||||
use LdapRecord\Query\ObjectNotFoundException;
|
||||
|
||||
use App\Classes\LDAP\Attribute\Factory;
|
||||
|
||||
@ -19,16 +18,30 @@ class Entry extends Model
|
||||
*/
|
||||
public static $objectClasses = [];
|
||||
|
||||
/* OVERRIDES */
|
||||
|
||||
public function getAttributes(): array
|
||||
{
|
||||
$result = collect();
|
||||
foreach (parent::getAttributes() as $attribute => $value) {
|
||||
$result->put($attribute,Factory::create($attribute,$value));
|
||||
}
|
||||
|
||||
return $result->toArray();
|
||||
}
|
||||
|
||||
/* STATIC METHODS */
|
||||
|
||||
/**
|
||||
* Gets the root DN of the specified LDAPServer, or throws an exception if it
|
||||
* can't find it.
|
||||
*
|
||||
* @param null $connection
|
||||
* @return Collection
|
||||
* @throws ModelNotFoundException
|
||||
* @throws ObjectNotFoundException
|
||||
* @testedin GetBaseDNTest::testBaseDNExists();
|
||||
*/
|
||||
public function baseDN($connection = NULL): ?Collection
|
||||
public static function baseDN($connection = NULL): ?Collection
|
||||
{
|
||||
$base = static::on($connection ?? (new static)->getConnectionName())
|
||||
->in(NULL)
|
||||
@ -45,16 +58,21 @@ class Entry extends Model
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getAttributes(): array
|
||||
{
|
||||
$result = collect();
|
||||
foreach (parent::getAttributes() as $attribute => $value) {
|
||||
$result->put($attribute,Factory::create($attribute,$value));
|
||||
}
|
||||
/* ATTRIBUTES */
|
||||
|
||||
return $result->toArray();
|
||||
/**
|
||||
* Return a key to use for sorting
|
||||
*
|
||||
* @todo This should be the DN in reverse order
|
||||
* @return string
|
||||
*/
|
||||
public function getSortKeyAttribute(): string
|
||||
{
|
||||
return $this->getDn();
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
|
||||
/**
|
||||
* Return an icon for a DN based on objectClass
|
||||
*
|
||||
@ -126,7 +144,7 @@ class Entry extends Model
|
||||
*
|
||||
* @param null $connection
|
||||
* @return Entry|null
|
||||
* @throws ModelNotFoundException
|
||||
* @throws ObjectNotFoundException
|
||||
* @testedin TranslateOidTest::testRootDSE();
|
||||
*/
|
||||
public function rootDSE($connection = NULL): ?Entry
|
||||
|
@ -17,4 +17,11 @@ class User extends Model
|
||||
public static $objectClasses = [
|
||||
'posixAccount',
|
||||
];
|
||||
}
|
||||
|
||||
/* METHODS */
|
||||
|
||||
public function getDn(): string
|
||||
{
|
||||
return $this->exists ? parent::getDn() : 'Anonymous';
|
||||
}
|
||||
}
|
@ -37,9 +37,16 @@
|
||||
<div class="font-icon-wrapper float-left mr-1 server-icon">
|
||||
<a class="p-0 m-0" href="{{ LaravelLocalization::localizeUrl('info') }}" onclick="return false;" style="display: contents;"><i class="fas fa-fw fa-info pr-1 pl-1"></i></a>
|
||||
</div>
|
||||
{{--
|
||||
<div class="font-icon-wrapper float-left ml-1 mr-1 server-icon">
|
||||
<a class="p-0 m-0" href="{{ LaravelLocalization::localizeUrl('schema') }}" onclick="return false;" style="display: contents;"><i class="fas fa-fw fa-fingerprint pr-1 pl-1"></i></a>
|
||||
</div>
|
||||
--}}
|
||||
@env(['local'])
|
||||
<div class="font-icon-wrapper float-right ml-1 mr-1 server-icon">
|
||||
<a class="p-0 m-0" href="{{ LaravelLocalization::localizeUrl('debug') }}" onclick="return false;" style="display: contents;"><i class="fas fa-fw fa-toolbox pr-1 pl-1"></i></a>
|
||||
</div>
|
||||
@endenv
|
||||
<div class="clearfix"></div>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -51,6 +51,10 @@
|
||||
</div>
|
||||
|
||||
<div class="app-header-right">
|
||||
@if(! request()->isSecure())
|
||||
<span class="badge badge-danger">WARNING - SESSION NOT SECURE</span>
|
||||
@endif
|
||||
|
||||
<div class="header-btn-lg pr-0">
|
||||
<div class="widget-content p-0">
|
||||
<div class="widget-content-wrapper">
|
||||
|
40
resources/views/debug.blade.php
Normal file
40
resources/views/debug.blade.php
Normal file
@ -0,0 +1,40 @@
|
||||
<div class="card card-solid">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h3 class="d-inline-block">DEBUG Information</h3>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Setting</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<!-- User Logged In -->
|
||||
<tr>
|
||||
<td>User</td>
|
||||
<td>{{ $user }}</td>
|
||||
</tr>
|
||||
|
||||
<!-- Base DNs -->
|
||||
<tr>
|
||||
<td>BaseDN(s)</td>
|
||||
<td>
|
||||
<table class="table table-sm table-borderless">
|
||||
@foreach(\App\Ldap\Entry::baseDN()->sort(function($item) { return $item->sortKey; }) as $item)
|
||||
<tr>
|
||||
<td>{{ $item->getDn() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -29,6 +29,7 @@ Route::group(['prefix' => LaravelLocalization::setLocale()], function() {
|
||||
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('logout',[LoginController::class,'logout']);
|
||||
|
Loading…
Reference in New Issue
Block a user