Code

Added acls for printer glpi
[gosa.git] / plugins / admin / systems / class_goLdapServer.inc
index 271dabdf002d192c4fb63a23fffefc4778d498fd..fa7896b541b94e4871ae9a2bc2a4a4893985ae76 100644 (file)
@@ -41,6 +41,7 @@ class goLdapServer extends plugin{
 
   function getListEntry()
   {
+    $this->updateStatusState();
     $flag = $this->StatusFlag;
     $fields['Status']     = $this->$flag;
     $fields['Message']    = _("LDAP Service");
@@ -56,6 +57,13 @@ class goLdapServer extends plugin{
   function remove_from_parent()
   {
     plugin::remove_from_parent();
+
+    /* Remove status flag, it is not a memeber of 
+        this->attributes, so ensure that it is deleted too */
+    if(!empty($this->StatusFlag)){
+      $this->attrs[$this->StatusFlag] = array();
+    }
+
     /* Check if this is a new entry ... add/modify */
     $ldap = $this->config->get_ldap_link();
     $ldap->cat($this->dn,array("objectClass"));
@@ -66,7 +74,7 @@ class goLdapServer extends plugin{
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
     }
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing server services/ldap with dn '%s' failed."),$this->dn));
     $this->handle_post_events("remove");
   }
 
@@ -84,7 +92,7 @@ class goLdapServer extends plugin{
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
     }
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/ldap with dn '%s' failed."),$this->dn));
     if($this->initially_was_account){
       $this->handle_post_events("modify");
     }else{
@@ -112,7 +120,7 @@ class goLdapServer extends plugin{
       $attrs[$flag] = $value;
       $this->$flag = $value;
       $ldap->modify($attrs);
-      show_ldap_error($ldap->get_error());
+      show_ldap_error($ldap->get_error(), sprintf(_("Set status flag for server services/ldap with dn '%s' failed."),$this->dn));
       $this->action_hook();
     }
   }
@@ -176,6 +184,41 @@ class goLdapServer extends plugin{
     }
   }
 
+  /* Get updates for status flag */
+  function updateStatusState()
+  {
+    if(empty($this->StatusFlag)) return;
+
+    $attrs = array();
+    $flag = $this->StatusFlag;
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->cn);
+    $ldap->cat($this->dn,array($flag));
+    if($ldap->count()){
+      $attrs = $ldap->fetch();
+    }
+    if(isset($attrs[$flag][0])){
+      $this->$flag = $attrs[$flag][0];
+    }
+  }
+
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Ldap"),
+          "plDescription" => _("Ldap service"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "goLdapBase" => _("Ldap base"))
+          ));
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>