Code

Fixed acls for system management
[gosa.git] / plugins / admin / systems / class_winGeneric.inc
index b2002b79e4b089946054f4984192c6c80102fa47..01fbbef1a136f6034b291ba8d4e77496b3dbbb4a 100644 (file)
@@ -74,6 +74,31 @@ class wingeneric extends plugin
       return($display);
     }
 
+    /* Base select dialog */
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^chooseBase/",$name) && $once){
+        $once = false;
+        $this->dialog = new baseSelectDialog($this->config,$this);
+        $this->dialog->setCurrentBase($this->base);
+      }
+    }
+
+    /* Dialog handling */
+    if(is_object($this->dialog)){
+      /* Must be called before save_object */
+      $this->dialog->save_object();
+
+      if($this->dialog->isClosed()){
+        $this->dialog = false;
+      }elseif($this->dialog->isSelected()){
+        $this->base = $this->dialog->isSelected();
+        $this->dialog= false;
+      }else{
+        return($this->dialog->execute());
+      }
+    }
+
     /* Fill templating stuff */
     $smarty= get_smarty();
 
@@ -98,7 +123,7 @@ class wingeneric extends plugin
     $this->netConfigDNS->remove_from_parent();
     $ldap= $this->config->get_ldap_link();
     $ldap->rmdir($this->dn);
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of system wingeneric/generic with dn '%s' failed."),$this->dn));
     $this->handle_post_events("remove");
 
     /* Delete references to object groups */
@@ -127,7 +152,9 @@ class wingeneric extends plugin
   /* Check supplied data */
   function check()
   {
-    $message=$this->netConfigDNS->check();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+    $message= array_merge($message, $this->netConfigDNS->check());
     $this->dn= "cn=".$this->cn.",ou=netdevices,ou=systems,".$this->base;
 
     $ui= get_userinfo();
@@ -186,18 +213,40 @@ class wingeneric extends plugin
       }
 
       $ldap->cd($this->dn);
-      $ldap->modify($this->attrs);
+      $this->cleanup();
+      $ldap->modify ($this->attrs); 
+
       $this->handle_post_events("modify");
     }
 
     $this->netConfigDNS->cn = $this->cn;
     $this->netConfigDNS->save($this->dn);
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving of system wingeneric/generic with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
     $this->postcreate();
   }
 
+  /* Return plugin informations for acl handling
+  #FIXME FAIscript seams to ununsed within this class... */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Win generic"),
+          "plDescription" => _("Windows workstation generic"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("winworkstation" => array("description"  => _("Win workstation"),
+                                                          "objectClass"  => "gotoWorkstation")),
+          "plProvidedAcls"=> array(
+            "cn"                  => _("Workstation name"),
+            "description"         => _("Description"))
+          ));
+  }
+
+
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: