Code

Include personal title in cn/dn
[gosa.git] / plugins / personal / connectivity / class_intranetAccount.inc
index b1831285ee59cf0c6715fd48dcd9c1bd574ca28f..1f475bf2578b022e78771964ef8bddd448cb9a92 100644 (file)
@@ -27,6 +27,8 @@ class intranetAccount extends plugin
   /* ObjectClasses list for save action */
   var $objectclasses= array("gosaIntranetAccount");
 
+  var $uid ="";
+
   /*! \brief Konstructor  
                
        \param $config  The Config Object used to initialise plugin
@@ -35,9 +37,14 @@ class intranetAccount extends plugin
       \version 1.00
       \date    1.07.2005
   */
-  function intranetAccount ($config, $dn= NULL)
+  function intranetAccount ($config, $dn= NULL, $parent= NULL)
   {
-       plugin::plugin ($config, $dn);
+       plugin::plugin ($config, $dn, $parent);
+       
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
   }
 
   /*!
@@ -53,7 +60,7 @@ class intranetAccount extends plugin
   function execute()
   {
        /* Call parent execute */
-       plugin::execute();
+//     plugin::execute();
 
        $display= "";
 
@@ -89,17 +96,21 @@ class intranetAccount extends plugin
   */
   function remove_from_parent()
   {
-       plugin::remove_from_parent();
-       $ldap= $this->config->get_ldap_link();
+         if(chkacl($this->acl, 'intranetAccount') == ""){
+                 plugin::remove_from_parent();
+                 $ldap= $this->config->get_ldap_link();
+
+                 $ldap->cd($this->dn);
+                 @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+                                 $this->attributes, "Save");
+                 $this->cleanup();
+                 $ldap->modify ($this->attrs); 
 
-        $ldap->cd($this->dn);
-        @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-                $this->attributes, "Save");
-       $ldap->modify($this->attrs);
-       show_ldap_error($ldap->get_error());
+                 show_ldap_error($ldap->get_error(), _("Removing intranet account failed"));
 
-       /* Optionally execute a command after we're done */
-       $this->postremove();
+                 /* Optionally execute a command after we're done */
+                 $this->postremove(array("uid"=>$this->uid));
+         }
   }
 
 
@@ -141,16 +152,20 @@ class intranetAccount extends plugin
        */
   function save()
   {
-       plugin::save();
-
-       /* Write back to ldap */
-       $ldap= $this->config->get_ldap_link();
-       $ldap->cd($this->dn);
-       $ldap->modify($this->attrs);
-       show_ldap_error($ldap->get_error());
-
-       /* Optionally execute a command after we're done */
-       $this->postcreate();
+         if(chkacl($this->acl, 'intranetAccount') == ""){
+                 plugin::save();
+                       
+                 /* Write back to ldap */
+                 $ldap= $this->config->get_ldap_link();
+                 $ldap->cd($this->dn);
+                 $this->cleanup();
+                 $ldap->modify ($this->attrs); 
+
+                 show_ldap_error($ldap->get_error(), _("Saving intranet account failed"));
+
+                 /* Optionally execute a command after we're done */
+                 $this->postcreate(array("uid"=> $this->uid));
+         }
   }
 
 }