Tag baseDNs as bases, and show their full DN in the tree

This commit is contained in:
Deon George 2025-07-03 18:34:35 +08:00
parent 7346a3daf5
commit 73f66eb282
3 changed files with 17 additions and 4 deletions

View File

@ -181,8 +181,11 @@ final class Server
$result = collect(); $result = collect();
// @note: Incase our rootDSE didnt return a namingcontext, we'll have no base DNs // @note: Incase our rootDSE didnt return a namingcontext, we'll have no base DNs
foreach ($namingcontexts as $dn) foreach ($namingcontexts as $dn) {
$result->push(self::get($dn)->read()->find($dn)); $o = self::get($dn)->read()->find($dn);
$o->setBase();
$result->push($o);
}
return $result->filter()->sort(fn($item)=>$item->sort_key); return $result->filter()->sort(fn($item)=>$item->sort_key);
}); });
@ -501,7 +504,6 @@ final class Server
* Get the Schema DN * Get the Schema DN
* *
* @return string * @return string
* @throws ObjectNotFoundException
*/ */
public function schemaDN(): string public function schemaDN(): string
{ {

View File

@ -24,7 +24,7 @@ class AjaxController extends Controller
{ {
return Server::baseDNs() return Server::baseDNs()
->map(fn($item)=> [ ->map(fn($item)=> [
'title'=>$item->getRdn(), 'title'=>$item->is_base ? $item->getDn() : $item->getRdn(),
'item'=>$item->getDNSecure(), 'item'=>$item->getDNSecure(),
'lazy'=>TRUE, 'lazy'=>TRUE,
'icon'=>'fa-fw fas fa-sitemap', 'icon'=>'fa-fw fas fa-sitemap',

View File

@ -39,6 +39,7 @@ class Entry extends Model
// For new entries, this is the container that this entry will be stored in // For new entries, this is the container that this entry will be stored in
private string $rdnbase; private string $rdnbase;
private(set) bool $is_base;
/* OVERRIDES */ /* OVERRIDES */
@ -574,6 +575,16 @@ class Entry extends Model
return [$attribute,$tags]; return [$attribute,$tags];
} }
/**
* Is this entry a baseDN
*
* @return void
*/
public function setBase(): void
{
$this->is_base = TRUE;
}
public function setRDNBase(string $bdn): void public function setRDNBase(string $bdn): void
{ {
if ($this->exists) if ($this->exists)