Code

Updated sudo to use the generic user/group select dialogs
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 09:50:29 +0000 (09:50 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 09:50:29 +0000 (09:50 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15356 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc
gosa-plugins/sudo/admin/sudo/trust_machines.tpl [deleted file]

index 628da1b60ce85d51f5e51b0d9970c66a9223ab4a..acab2b3fa38aedf99983d753de9d02f5cfedd13a 100644 (file)
@@ -178,25 +178,19 @@ class sudo extends plugin
     /*********************
        Add users 
      *********************/ 
-  
     if(isset($_POST['list_sudoUser']) && !is_object($this->dialog) && $this->acl_is_writeable("sudoUser")){
-      $used = array();
-      foreach($this->sudoUser as $name){
-        $used[] = preg_replace("/^!/","",$name);
-      }
-      $this->dialog =new target_list_users($this->config,$used);
+      $this->dialog =new userGroupSelect($this->config,get_userinfo());
     }
    
     /* Add selected hosts  to the sudoUser list */ 
-    if(isset($_POST['SavetargetSelectDialog']) && $this->dialog instanceof target_list_users){
+    if(isset($_POST['userGroupSelect_save']) && $this->dialog instanceof userGroupSelect){
       if($this->acl_is_writeable("sudoUser")){
         foreach($this->dialog->save() as $entry){
           if(in_array("posixGroup",$entry['objectClass'])){
             $name = trim("%".$entry['cn'][0]);
           }elseif(isset($entry['uid'][0])){
             $name = trim($entry['uid'][0]);
-          }else{
-            print_a($entry);
           }
           if(!in_array($name,$this->sudoUser) && !in_array("!".$name,$this->sudoUser)){
             $this->sudoUser[] = $name;
@@ -207,6 +201,28 @@ class sudo extends plugin
       $this->dialog = NULL;
     }    
 
+    if(isset($_POST['userGroupSelect_cancel']) && $this->dialog instanceOf userGroupSelect){
+      unset($this->dialog);
+      $this->dialog = NULL;
+    }    
+
+    if($this->dialog instanceOf userGroupSelect){
+      $used = array();
+      foreach($this->sudoUser as $name){
+        $str = preg_replace("/^!/","",$name);
+        if(preg_match("/^%/", $str)){
+          $used['cn'][] = preg_replace("/^%/","",$str);
+        }else{
+          $used['uid'][] = $str;
+        }
+      }
+
+      // Build up blocklist
+      session::set('filterBlacklist', $used);
+      return($this->dialog->execute());
+    }
+
 
     /*********************
        Add systems 
@@ -239,7 +255,7 @@ class sudo extends plugin
        Dialog handling / display / close  
      *********************/ 
   
-    if(isset($_POST['ClosetargetSelectDialog']) && is_object($this->dialog)){
+    if(isset($_POST['userGroupSelect_cancel']) && is_object($this->dialog)){
       unset($this->dialog);
       $this->dialog = NULL;
     }    
@@ -462,10 +478,6 @@ class sudo extends plugin
       $this->cn = "defaults";
     }  
 
-    if(is_object($this->dialog)){
-      $this->dialog->save_object();
-    }
-
     /* Trust mode - special handling */
     if($this->acl_is_writeable("trustModel")){
       if (isset($_POST['trustmode'])){
diff --git a/gosa-plugins/sudo/admin/sudo/trust_machines.tpl b/gosa-plugins/sudo/admin/sudo/trust_machines.tpl
deleted file mode 100644 (file)
index f7b0b2c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=4>
-<tr>
-  <td style="vertical-align:top;">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px">
-     <b>{t}Select systems to add{/t} {$hint}</b><br>
-    </p>
-   </div>
-   <div class="contentboxb">
-    <p class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <select style="width:100%; margin-top:4px; height:450px;" name="wslist[]" size="15" multiple>
-       {html_options values=$wslist output=$wslist}
-     </select>
-    </p>
-   </div>
-  </td>
-  <td style="vertical-align:top; width:350px">
-   <div class="contentboxh" style="height:20px;">
-    <p class="contentboxh" style="font-size:12px"><img src="{$launchimage}" align="right" alt="[F]"><b>{
-t}Filters{/t}</b></p>
-   </div>
-   <div class="contentboxb" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
-     <table summary="" style="width:100%;">
-      {$alphabet}
-     </table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$tree_image}" align=middle>&nbsp;{t}Display systems of department{/t}</td>
-    <td><select name="depselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
-      {html_options options=$deplist selected=$depselect}
-    </select></td></tr></table>
-    <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$search_image}" align=middle>&nbsp;{t}Display systems matching{/t}</td>
-    <td><input type='text' name='regex' maxlength='20' value='{$regex}' title='{t}Regular expression for matching addresses{/t}' onChange="mainform.submit()"></td></tr></table>
-   {$apply}
-   </div>
-  </td>
-</tr>
-</table>
-
-<p class="plugbottom">
-  <input type=submit name="add_ws_finish" value="{msgPool type=addButton}">
-  &nbsp;
-  <input type=submit name="add_ws_cancel" value="{msgPool type=cancelButton}">
-</p>