Code

Added better acl assignment
[gosa.git] / plugins / admin / systems / class_servGeneric.inc
index c5f4229c517c7623479f371f26cbb5936605231c..b85d9c834acfad10647d435721ebd3500e23d48e 100644 (file)
@@ -8,6 +8,7 @@ class servgeneric extends plugin
   var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
 
   /* Generic terminal attributes */
+  var $ignore_account= TRUE;
   var $interfaces= array();
 
   /* Needed values and lists */
@@ -42,6 +43,9 @@ class servgeneric extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Do we represent a valid server? */
     if (!$this->is_account && $this->parent == NULL){
       $display= "<img alt=\"\" src=\"images/stop.png\" align=middle>&nbsp;<b>".
@@ -53,7 +57,7 @@ class servgeneric extends plugin
     if (isset($_POST['action'])){
       switch($_POST['action']){
         case 'wake':
-          $cmd= $this->search($this->config->data['TABS'], "servgeneric", "WAKECMD");
+          $cmd= search_config($this->config->data['TABS'], "servgeneric", "WAKECMD");
           if ($cmd == ""){
             print_red(_("No WAKECMD definition found in your gosa.conf"));
           } else {
@@ -65,7 +69,7 @@ class servgeneric extends plugin
           break;
 
         case 'reboot':
-          $cmd= $this->search($this->config->data['TABS'], "servgeneric", "REBOOTCMD");
+          $cmd= search_config($this->config->data['TABS'], "servgeneric", "REBOOTCMD");
           if ($cmd == ""){
             print_red(_("No REBOOTCMD definition found in your gosa.conf"));
           } else {
@@ -77,7 +81,7 @@ class servgeneric extends plugin
           break;
 
         case 'halt':
-          $cmd= $this->search($this->config->data['TABS'], "servgeneric", "HALTCMD");
+          $cmd= search_config($this->config->data['TABS'], "servgeneric", "HALTCMD");
           if ($cmd == ""){
             print_red(_("No HALTCMD definition found in your gosa.conf"));
           } else {
@@ -99,6 +103,7 @@ class servgeneric extends plugin
       $smarty->assign($attr."ACL", chkacl($this->acl, $attr));
       $smarty->assign("$attr", $this->$attr);
     }
+    $smarty->assign("staticAddress", "");
     $smarty->assign("base_select", $this->base);
 
     /* Assign status */
@@ -158,7 +163,7 @@ class servgeneric extends plugin
 
     /* must: cn */
     if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){
-      $message[]= "The required field 'Server name' is not set.";
+      $message[]= _("The required field 'Server name' is not set.");
     }
 
     $ui= get_userinfo();
@@ -212,10 +217,20 @@ class servgeneric extends plugin
       $ldap->add($this->attrs);
       $mode= "add";
     } else {
-      if ($this->orig_dn != $this->dn){
-        $this->move($this->orig_dn, $this->dn);
+   
+      /* cn is not case sensitive for ldap, but for php it is!! */ 
+      if($this->config->current['DNMODE'] == "cn"){
+        if (strtolower($this->orig_dn) != (strtolower($this->dn))){
+          $this->move($this->orig_dn, $this->dn);
+          plugin::save();
+        }
+      }else{
+        if ($this->orig_dn != $this->dn){
+          $this->move($this->orig_dn, $this->dn);
+          plugin::save();
+        }
       }
-
+  
       $ldap->cd($this->dn);
       $ldap->modify($this->attrs);
       $mode= "modify";