From 48131c1b4ed31f296175ea3af855225b1e172cd1 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 2 Mar 2021 22:19:00 +1100 Subject: [PATCH] Fix showing DN icon for RootDSE, fix readme git clone --- README.md | 2 +- app/Http/Controllers/HomeController.php | 7 +++++-- app/Ldap/Entry.php | 3 +++ resources/views/widgets/dn.blade.php | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f1bb47a..449b6e0 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ In summary, for the time being, expect `master` to be buggy and broken, and I'll #### Installation 1. Checkout the code from github ```bash - git checkout https://github.com/leenooks/phpLDAPadmin.git + git clone https://github.com/leenooks/phpLDAPadmin.git ``` 1. Install composer dependencies. diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 1dbb7b6..29eb8cd 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -34,8 +34,10 @@ class HomeController extends Controller public function info() { + $root = (new Entry)->rootDSE(); + try { - $attrs = collect((new Entry)->rootDSE()->getAttributes()) + $attrs = collect($root->getAttributes()) ->transform(function($item,$key) { foreach ($item as $k=>$v) { if (preg_match('/[0-9]+\.[0-9]+\.[0-9]+/',$v)) { @@ -59,6 +61,7 @@ class HomeController extends Controller return view('widgets.dn') ->with('dn',__('Server Info')) + ->with('leaf',$root) ->with('attributes',$this->sortAttrs($attrs)); } @@ -68,7 +71,7 @@ class HomeController extends Controller return view('widgets.dn') ->with('dn',$dn) - ->with('leaf',$x=(new Server())->fetch($dn)) + ->with('leaf',$x=(new Server)->fetch($dn)) ->with('attributes',$x ? $this->sortAttrs(collect($x->getAttributes())) : []); } diff --git a/app/Ldap/Entry.php b/app/Ldap/Entry.php index 94cc0bc..2ab7850 100644 --- a/app/Ldap/Entry.php +++ b/app/Ldap/Entry.php @@ -102,6 +102,9 @@ class Entry extends Model elseif (in_array('server',$objectclasses)) return 'fas fa-server'; + elseif (in_array('openldaprootdse',$objectclasses)) + return 'fas fa-info'; + // Default return 'fa-fw fas fa-cog'; } diff --git a/resources/views/widgets/dn.blade.php b/resources/views/widgets/dn.blade.php index 450d120..b8b650f 100644 --- a/resources/views/widgets/dn.blade.php +++ b/resources/views/widgets/dn.blade.php @@ -7,7 +7,7 @@ {{ $leaf->entryuuid[0] ?? '' }} @endsection @section('page_icon') - {{ $leaf->icon() }} + {{ $leaf->icon() ?? 'fas fa-info' }} @endsection @section('main-content')