Ported the schema browser

This commit is contained in:
Deon George
2023-02-14 21:38:42 +11:00
parent 815cd49868
commit 8ec1d2b1fe
31 changed files with 2498 additions and 3093 deletions

View File

@@ -34,4 +34,31 @@ class APIController extends Controller
];
});
}
public function schema_view(Request $request)
{
$server = new Server;
switch($request->type) {
case 'objectclasses':
return view('frames.schema.objectclasses')
->with('objectclasses',$server->schema('objectclasses')->sortBy(function($item) { return strtolower($item->name); }));
case 'attributetypes':
return view('frames.schema.attributetypes')
->with('server',$server)
->with('attributetypes',$server->schema('attributetypes')->sortBy(function($item) { return strtolower($item->name); }));
case 'ldapsyntaxes':
return view('frames.schema.ldapsyntaxes')
->with('ldapsyntaxes',$server->schema('ldapsyntaxes')->sortBy(function($item) { return strtolower($item->description); }));
case 'matchingrules':
return view('frames.schema.matchingrules')
->with('matchingrules',$server->schema('matchingrules')->sortBy(function($item) { return strtolower($item->name); }));
default:
abort(404);
}
}
}

View File

@@ -8,7 +8,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\File;
use LdapRecord\Models\ModelNotFoundException;
use LdapRecord\Query\ObjectNotFoundException;
use App\Ldap\Entry;
use App\Classes\LDAP\Server;
@@ -49,7 +49,7 @@ class HomeController extends Controller
* LDAP Server INFO
*
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
* @throws ModelNotFoundException
* @throws ObjectNotFoundException
*/
public function info()
{
@@ -74,7 +74,7 @@ class HomeController extends Controller
});
// @todo If we cant get server info, we should probably show a nice error dialog
} catch (ModelNotFoundException $e) {
} catch (ObjectNotFoundException $e) {
$attrs = collect();
}
@@ -98,6 +98,11 @@ class HomeController extends Controller
->with('dn',$dn);
}
public function schema_frame()
{
return view('frames.schema');
}
/**
* Sort the attributes
*