Code

'Updated save method for class device
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 08:04:38 +0000 (08:04 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 08:04:38 +0000 (08:04 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19693 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/devices/class_registeredDevice.inc

index 2a7764ee63bd01642951efadce7e3efc8c382f23..c295d888ead6276621c407716d08061802302ca5 100644 (file)
@@ -50,12 +50,25 @@ class registeredDevice extends plugin
 
     function save()
     {
+
         plugin::save();
+
+        // Append and remove dynmic object classes
+        foreach($this->dynClasses as $oc => $attrs){
+            $this->attrs['objectClass'] = array_remove_entries(array($oc), $this->attrs['objectClass']);
+            foreach($attrs as $attr){
+                if(isset($this->attrs[$attr]) && !empty($this->attrs[$attr])){
+                    $this->attrs['objectClass'][] = $oc;
+                    break;
+                }
+            }
+        }
+
         $this->cleanup();
         $ldap=$this->config->get_ldap_link();
         $ldap->cd($this->config->current['BASE']);
         $ldap->cd($this->dn);
-        
+
         if($this->initially_was_account){
             $ldap->modify($this->attrs);
         }else{