Code

Updated sudo classes
[gosa.git] / gosa-plugins / sudo / admin / sudo / class_sudoManagement.inc
index fe78bd12ac9b7109827cf647af314b378dcfb422..7be36c35f23547da610bff997e89b4999a7203d4 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/*! \brief This is the sudo management class. \
+           This class allows to add/remove/edit sudo roles with GOsa. \
+           All roles will be listed by this plugin, the displayed objects \
+            can also be filtered.
+*/
 class sudoManagement extends plugin
 {
   /* Definitions */
-  var $plHeadline     = "Sudo";
-  var $plDescription  = "Manage sudo roles";
-
-  var $DivListSudo    = NULL;
-  var $base           = "";
-
-  var $sudotabs       = NULL;
-
-  function sudoManagement (&$config, &$ui)
+  public $plHeadline     = "Sudo roles";
+  public $plDescription  = "Manage sudo roles";
+
+  private $DivListSudo    = NULL;
+  private $sudotabs       = NULL;
+  private $base           = "";
+  /*! \brief */ 
+  public function __construct(&$config, &$ui)
   {
     /* Save configuration for internal use */
     $this->config = &$config;
@@ -43,7 +48,9 @@ class sudoManagement extends plugin
   }
 
 
-  function execute()
+  /*! \brief Generate && Display HTML content 
+   */
+  public function execute()
   {
     /* Call parent execute */
     plugin::execute();
@@ -136,6 +143,10 @@ class sudoManagement extends plugin
           unset ($this->sudotabs);
           $this->sudotabs= NULL;
           session::un_set('objectinfo');
+        }else{
+          $this->dn = $this->sudotabs->dn;
+          $this->sudotabs= new sudotabs($this->config, $this->config->data['TABS']['SUDOTABS'], $this->dn);
+          session::set('objectinfo',$this->dn);
         }
       } else {
         /* Ok. There seem to be errors regarding to the tab data,
@@ -198,7 +209,7 @@ class sudoManagement extends plugin
         }
 
         /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("info", msgPool::deleteInfo($dns_names,_("sudo role")));
+        $smarty->assign("info", msgPool::deleteInfo($dns_names,_("Sudo role")));
         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       }
     }
@@ -300,8 +311,11 @@ class sudoManagement extends plugin
     return($this->DivListSudo->Draw());
   }
 
-
-  function list_get_selected_items()
+  
+  /*! \brief  Return all selected elements from HTML list 
+      @return Array List of all selected list elements 
+    */
+  private function list_get_selected_items()
   {
     $ids = array();
     foreach($_POST as $name => $value){
@@ -314,7 +328,9 @@ class sudoManagement extends plugin
   }
 
 
-  function reload($CreatePosixsList=false)
+  /*! \brief  Reload the list of sudo roles. 
+   */
+  private function reload($CreatePosixsList=false)
   {
     $this->list             = array();
     $base                   = $this->base;
@@ -342,39 +358,40 @@ class sudoManagement extends plugin
   }
 
 
-  /* Save data to object */
-  function save_object()
+  /*! \brief Save HTML post data to object 
+   */
+  public function save_object()
   {
     $this->DivListSudo->save_object();
   }
 
-
-  function remove_lock()
-  {
-    if (isset($this->sudotabs->dn)){
-      del_lock ($this->sudotabs->dn);
-    }
-  }
-
-
-  function remove_from_parent()
+  
+  /*! \brief Remove this account 
+   */
+  public function remove_from_parent()
   {
     /* Optionally execute a command after we're done */
     $this->postremove();
   }
 
 
-  /* Save to LDAP */
-  function save()
+  /*! \brief Save to LDAP 
+   */
+  public function save()
   {
     /* Optionally execute a command after we're done */
     $this->postcreate();
   }
 
-  /* Unused functions  */
-  function check()  { }
-  function adapt_from_template($dn, $skip= array()) { }
-  function password_change_needed()  { }
+  
+  /*! \brief Remove lock from entry 
+   */
+  public function remove_lock()
+  {
+    if (isset($this->sudotabs->dn)){
+      del_lock ($this->sudotabs->dn);
+    }
+  }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>