From ddb5ed03464ee93d97f34b6f11958596995504bb Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 20 May 2011 23:53:39 +1000 Subject: [PATCH] Enabled hiding base DNs that users dont have access to --- config/config.php.example | 5 +++++ lib/Tree.php | 2 +- lib/ds.php | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/config.php.example b/config/config.php.example index 8b49506..a8a0d06 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -458,6 +458,11 @@ $servers->setValue('server','name','My LDAP Server'); /* Set this if you dont want this LDAP server to show in the tree */ // $servers->setValue('server','visible',true); +/* Set this if you want to hide the base DNs that dont exist instead of + displaying the message "The base entry doesnt exist, create it?" +// $servers->setValue('server','hide_noaccess_base',false); +# $servers->setValue('server','hide_noaccess_base',true); + /* This is the time out value in minutes for the server. After as many minutes of inactivity you will be automatically logged out. If not set, the default value will be ( session_cache_expire()-1 ) */ diff --git a/lib/Tree.php b/lib/Tree.php index b3efcf9..38a11d2 100644 --- a/lib/Tree.php +++ b/lib/Tree.php @@ -103,7 +103,7 @@ abstract class Tree { $return = array(); foreach ($this->entries as $details) - if ($details->isBaseDN()) + if ($details->isBaseDN() AND ((! $this->getServer()->getValue('server','hide_noaccess_base')) OR $details->isInLdap())) array_push($return,$details); return $return; diff --git a/lib/ds.php b/lib/ds.php index 8be379a..8b170fd 100644 --- a/lib/ds.php +++ b/lib/ds.php @@ -542,6 +542,10 @@ class Datastore { 'desc'=>'Whether this server is visible', 'default'=>true); + $this->default->server['hide_noaccess_base'] = array( + 'desc'=>'If base DNs are not accessible, hide them instead of showing create', + 'default'=>false); + # Authentication Information $this->default->login['auth_type'] = array( 'desc'=>'Authentication Type',