From: cajus Date: Tue, 1 Sep 2009 13:34:17 +0000 (+0000) Subject: Make the Home mechanism sensizive to non people bases. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ad2873b85be9890ef55df8e5cd4337ec2cc5a1e3;p=gosa.git Make the Home mechanism sensizive to non people bases. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14188 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_filter.inc b/gosa-core/include/class_filter.inc index cce5f48ca..373b37e9b 100644 --- a/gosa-core/include/class_filter.inc +++ b/gosa-core/include/class_filter.inc @@ -531,6 +531,30 @@ class filter { } + function getObjectBase($dn) + { + global $config; + $base= ""; + + // Try every object storage + $storage= $this->objectStorage; + if (!is_array($storage)){ + $storage= array($storage); + } + foreach ($storage as $location) { + $pattern= "/^[^,]+,".preg_quote($location, '/')."/i"; + $base= preg_replace($pattern, '', $dn); + } + + /* Set to base, if we're not on a correct subtree */ + if (!isset($config->idepartments[$base])){ + $base= $config->current['BASE']; + } + + return $base; + } + + } ?> diff --git a/gosa-core/include/class_listing.inc b/gosa-core/include/class_listing.inc index 911c904f0..1f819c2d2 100644 --- a/gosa-core/include/class_listing.inc +++ b/gosa-core/include/class_listing.inc @@ -514,7 +514,7 @@ class listing { } if ($action == 'HOME') { $ui= get_userinfo(); - $this->base= get_base_from_people($ui->dn); + $this->base= $this->filter->getObjectBase($ui->dn); } // Reload departments @@ -879,7 +879,7 @@ class listing { $listhead =""; /* Check if we are in users home department */ - if(!count($deps) ||$this->filter->base == get_base_from_people($ui->dn)){ + if(!count($deps) || $this->filter->base == $this->filter->getObjectBase($ui->dn)){ $enableHome = false; }