Code

Updated sudo stuff.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Apr 2008 06:21:50 +0000 (06:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Apr 2008 06:21:50 +0000 (06:21 +0000)
-Fixed a few lockings (not all)
-Updated delete abort.
-Updated dialog string.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10182 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/sudo/class_divListSudo.inc
gosa-core/plugins/admin/sudo/class_sudoManagement.inc
gosa-core/plugins/admin/sudo/main.inc
gosa-core/plugins/admin/sudo/remove.tpl

index 23e0b0fdf95ed9741ae68dfb437b13e6f086bc8a..b83c7ba08fe09740627408052a705a2ade75fbe2 100644 (file)
@@ -45,7 +45,7 @@ class divListSudo extends MultiSelectWindow
     $this->ui           = get_userinfo();
 
     /* Set list strings */
-    $this->SetTitle(_("List of sudo roles"));
+    $this->SetTitle(  _("List of sudo roles"));
     $this->SetSummary(_("List of sudo roles"));
     $this->EnableAplhabet(true);
 
@@ -74,7 +74,7 @@ class divListSudo extends MultiSelectWindow
     $this->AddRegex   ("Regex"    , _("Regular expression for matching role names")       , 
       "*" , true);
     $this->AddRegex   ("UserRegex", _("Regular expression for matching role member names"),
-       "*" , FALSE,"images/search_user.png");
+      "*" , FALSE,"images/search_user.png");
   }
 
 
index a0f9821edb6c6206cee80707d14023af98b85168..fe78bd12ac9b7109827cf647af314b378dcfb422 100644 (file)
@@ -45,8 +45,8 @@ class sudoManagement extends plugin
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
 
     /********************
       Handle Posts
@@ -71,7 +71,7 @@ class sudoManagement extends plugin
         $s_entry  = preg_replace("/^sudo_del_([0-9]*).*$/","\\1",$name);
       }
     }
-  
+
     if(isset($_GET['act']) && isset($_GET['id']) && $_GET['act'] == "edit_entry"){
       $id = trim($_GET['id']);
       if(isset($this->list[$id])){
@@ -79,7 +79,7 @@ class sudoManagement extends plugin
         $s_entry  = $id;
       } 
     }
+
     if(isset($_POST['menu_action']) && in_array($_POST['menu_action'],array("new_role","del_role"))){
       $s_action = $_POST['menu_action'];
     }
@@ -177,7 +177,7 @@ class sudoManagement extends plugin
 
       $ids = $this->list_get_selected_items();
 
-      if(!count($ids) && !empty($s_entry)){
+      if(!count($ids) && $s_entry!=""){
         $ids = array($s_entry);
       }
 
@@ -199,7 +199,6 @@ 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("multiple", true);
         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       }
     }
@@ -209,44 +208,44 @@ class sudoManagement extends plugin
       Delete entries confirmed
      ********************/
 
-      /* Confirmation for deletion has been passed. Sudo should be deleted. */
-      if (isset($_POST['delete_multiple_sudos_confirmed'])){
+    /* Confirmation for deletion has been passed. Sudo should be deleted. */
+    if (isset($_POST['delete_sudos_confirmed'])){
 
-        /* Remove user by user and check acls before removeing them */
-        foreach($this->dns as $key => $dn){
+      /* Remove user by user and check acls before removeing them */
+      foreach($this->dns as $key => $dn){
 
-          /* Load permissions for selected 'dn' and check if
-             we're allowed to remove this 'dn' */
-          $acl = $this->ui->get_permissions($dn,"sudo/sudo");
-          if(preg_match("/d/",$acl)){
+        /* Load permissions for selected 'dn' and check if
+           we're allowed to remove this 'dn' */
+        $acl = $this->ui->get_permissions($dn,"sudo/sudo");
+        if(preg_match("/d/",$acl)){
 
-            /* Delete request is permitted, perform LDAP action */
-            $this->sudotabs= new sudotabs($this->config,$this->config->data['TABS']['SUDOTABS'], $dn);
-            $this->sudotabs->set_acl_base($dn);
-            $this->sudotabs->delete ();
-            unset ($this->sudotabs);
-            $this->sudotabs= NULL;
+          /* Delete request is permitted, perform LDAP action */
+          $this->sudotabs= new sudotabs($this->config,$this->config->data['TABS']['SUDOTABS'], $dn);
+          $this->sudotabs->set_acl_base($dn);
+          $this->sudotabs->delete ();
+          unset ($this->sudotabs);
+          $this->sudotabs= NULL;
 
-          } else {
+        } else {
 
-            /* Normally this shouldn't be reached, send some extra
-               logs to notify the administrator */
-            msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
-            new log("security","sudo/".get_class($this),$dn,array(),"Tried to trick deletion.");
-          }
-          /* Remove lock file after successfull deletion */
-          del_lock ($dn);
-          unset($this->dns[$key]);
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
+          new log("security","sudo/".get_class($this),$dn,array(),"Tried to trick deletion.");
         }
+        /* Remove lock file after successfull deletion */
+        del_lock ($dn);
+        unset($this->dns[$key]);
       }
+    }
 
 
-      /********************
-        Delete MULTIPLE entries Canceled
-       ********************/
+    /********************
+      Delete entries Canceled
+     ********************/
 
-      /* Remove lock */
-    if(isset($_POST['delete_multiple_user_cancel'])){
+    /* Remove lock */
+    if(isset($_POST['delete_sudo_cancel'])){
       foreach($this->dns as $key => $dn){
         del_lock ($dn);
         unset($this->dns[$key]);
index 23f2c313d705db435861d3da3d75ef078259afb9..fb873a54a66a982288a683fc2fe1c0f50a90b557 100644 (file)
@@ -39,11 +39,11 @@ if ($remove_lock){
   /* Page header*/
   if (session::is_set('objectinfo')){
     $display= print_header(get_template_path('images/sudo.png'),
-                           _("Group administration"), "<img alt=\"\" align=\"middle\" src=\"".
+                            _("Sudo role administration"), "<img alt=\"\" align=\"middle\" src=\"".
                             get_template_path('images/closedlock.png')."\"> ".
                             @LDAP::fix(session::get('objectinfo')));
   } else {
-    $display= print_header(get_template_path('images/group.png'), _("Group administration"));
+    $display= print_header(get_template_path('images/sudo.png'), _("Sudo role administration"));
   }
 
   $display.= $output;
index 65166c23a71af35968244d380e2b9567f6efa6f8..44b858a4bf9c58bf243fd5e6af4f99a619f8a77a 100644 (file)
 </p>
 
 <p class="plugbottom">
-
-  {if $multiple}
-  <input type=submit name="delete_multiple_sudos_confirmed" value="{msgPool type=delButton}">
-  &nbsp;
-  <input type=submit name="delete_multiple_sudo_cancel" value="{msgPool type=cancelButton}">
-  {else}
-  <input type=submit name="delete_sudo_confirmed" value="{msgPool type=delButton}">
+  <input type=submit name="delete_sudos_confirmed" value="{msgPool type=delButton}">
   &nbsp;
-  <input type=submit name="delete_cancel" value="{msgPool type=cancelButton}">
-  {/if}
-
-
+  <input type=submit name="delete_sudo_cancel" value="{msgPool type=cancelButton}">
 </p>