Code

Added copy & paste for profiles
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Dec 2007 14:56:44 +0000 (14:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Dec 2007 14:56:44 +0000 (14:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8048 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiProfile.inc

index 0e5cacffd3384db95f95179360b4bb9fa063b810..4b5daea9b228ad9d07bf7027cb20334c20e26d67 100644 (file)
@@ -404,11 +404,18 @@ class faiProfile extends plugin
     }
 
     $ldap = $this->config->get_ldap_link();
-    $ldap->cd($_SESSION['CurrentMainBase']);
+
+    $base = $_SESSION['faifilter']['branch'];
+    if($base == "main"){
+      $base =$_SESSION['CurrentMainBase'];
+    }
+    $base = "ou=profiles,".$base;
+  
+    $ldap->cd($base);
     if ($this->old_cn == ""){
-      $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn."))",array("*"));
+      $ldap->ls("(&(objectClass=FAIprofile)(cn=".$this->cn."))",$base,array("*"));
     } else {
-      $ldap->search("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",array("*"));
+      $ldap->ls("(&(objectClass=FAIprofile)(cn=".$this->cn.")(!cn=".$this->old_cn."))",$base,array("*"));
     }
 
     if($ldap->count() || isset($this->FAIAllclasses[$this->cn])){
@@ -449,6 +456,28 @@ class faiProfile extends plugin
   }
 
 
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    /* Parse ldap attribute to get all assigned classes */
+    $tmp = split(" ",$this->FAIclass);
+    $tmp2 = array();
+    foreach($tmp as $class){
+      if(!empty($class)){
+        $tmp2[trim($class)] = trim($class);
+      }
+    }
+
+    /* Sort assigned classes */
+    if(is_array($tmp2)){
+      foreach($tmp2 as $class){
+        $this->FAIclasses[$class]=$class;
+      }
+    }
+  }
+
+
   /* Return plugin informations for acl handling */ 
   static function plInfo()
   {