Code

Make the Home mechanism sensizive to non people bases.
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 1 Sep 2009 13:34:17 +0000 (13:34 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 1 Sep 2009 13:34:17 +0000 (13:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14188 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_filter.inc
gosa-core/include/class_listing.inc

index cce5f48cae679dd4efae6d7e1cfa8bd618e2361b..373b37e9bd740dd510aa74691550f1fb047f36ac 100644 (file)
@@ -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;
+  }
+
+
 }
 
 ?>
index 911c904f06dc254c12121b74081c25d0b17e3bc8..1f819c2d213bd9b3d34cd6ac92285aaf30b34afe 100644 (file)
@@ -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;
     }