Code

Set DNS hidden if acount is disabled
[gosa.git] / plugins / personal / connectivity / class_pptpAccount.inc
index e98bb781aa83d42c3c2a2b0710a14eb4c95bfbc3..c7ed311e85213813ea2ee0acfab60c7822dbf74d 100644 (file)
@@ -1,9 +1,29 @@
 <?php
 
+/*
+  This code is part of GOsa (https://gosa.gonicus.de)
+  Copyright (C) 2005 Guillaume Delecourt
+  Copyright (C) 2005 Benoit Mortier
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
 class pptpAccount extends plugin
 {
   /* Definitions */
-  var $plHeadline= "PPTP Server";
+  var $plHeadline= "PPTP";
   var $plDescription= "This does something";
 
   /* CLI vars */
@@ -22,6 +42,9 @@ class pptpAccount extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+//     plugin::execute();
+
     /* Show tab dialog headers */
     $display= "";
 
@@ -35,10 +58,6 @@ class pptpAccount extends plugin
       $smarty->assign("wstate", "disabled");
     }
 
-    if ($this->parent != NULL){
-      $smarty->assign("tabbed", 1);
-    }
-
     $smarty->assign('gosapptpACL', chkacl($this->acl, 'gosapptp'));
 
     $display.= $smarty->fetch (get_template_path('pptp.tpl', TRUE, dirname(__FILE__)));
@@ -47,22 +66,26 @@ class pptpAccount extends plugin
 
   function remove_from_parent()
   {
-    /* Cancel if there's nothing to do here */
-    if (!$this->initially_was_account){
-      return;
-    }
+    if(chkacl($this->acl, 'gosapptp') == ""){
+      /* Cancel if there's nothing to do here */
+      if (!$this->initially_was_account){
+        return;
+      }
 
-    plugin::remove_from_parent();
-    $ldap= $this->config->get_ldap_link();
+      plugin::remove_from_parent();
+      $ldap= $this->config->get_ldap_link();
 
-    $ldap->cd($this->dn);
-    @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
-        $this->attributes, "Save");
-    $ldap->modify($this->attrs);
-    show_ldap_error($ldap->get_error());
+      $ldap->cd($this->dn);
+      @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+          $this->attributes, "Save");
+      $this->cleanup();
+$ldap->modify ($this->attrs); 
 
-    /* Optionally execute a command after we're done */
-    $this->handle_post_events('remove');
+      show_ldap_error($ldap->get_error());
+
+      /* Optionally execute a command after we're done */
+      $this->handle_post_events('remove');
+    }
   }
 
 
@@ -92,23 +115,26 @@ class pptpAccount extends plugin
   /* Save to LDAP */
   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 */
-    if ($this->initially_was_account == $this->is_account){
-      if ($this->is_modified){
-        $this->handle_post_events("mofify");
+    if(chkacl($this->acl, 'gosapptp') == ""){
+      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());
+
+      /* Optionally execute a command after we're done */
+      if ($this->initially_was_account == $this->is_account){
+        if ($this->is_modified){
+          $this->handle_post_events("mofify");
+        }
+      } else {
+        $this->handle_post_events("add");
       }
-    } else {
-      $this->handle_post_events("add");
     }
-
   }
 
 }