Code

Updated sudo plugin
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Apr 2008 06:58:12 +0000 (06:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Apr 2008 06:58:12 +0000 (06:58 +0000)
-Fixed Add system/user acls

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

gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc
gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc

index a7697f1bb08eb766918476d5bd80f423c85eaa6f..05a1a13d51ef45ad407c25d1275e823d32328833 100644 (file)
@@ -113,6 +113,15 @@ class sudo extends plugin
       }
 
     }
+
+    /* Get global filter config */
+    if (!session::is_set("sysfilter")){
+      $ui= get_userinfo();
+      $base= get_base_from_people($ui->dn);
+      $sysfilter= array( "depselect"       => $base,
+          "regex"           => "*");
+      session::set("sysfilter", $sysfilter);
+    }
   }
 
 
@@ -159,7 +168,7 @@ class sudo extends plugin
 
     /* Show ws dialog */
     if ($this->show_ws_dialog){
-      $this->display_trust_add_dialog();
+      return($this->display_trust_add_dialog());
     }
 
 
@@ -532,12 +541,14 @@ class sudo extends plugin
     $regex= $sysfilter['regex'];
     $filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
 
-    $deps_a = array(get_ou("serverou"),
-        get_ou("terminalou"),
-        get_ou("workstationou"));
+    $res = array();
+    $res= array_merge($res,get_sub_list($filter, array("terminal"), get_ou("terminalou"),
+        get_ou("systemsou").$sysfilter['depselect'],          array("cn"), GL_SUBSEARCH | GL_SIZELIMIT));
+    $res= array_merge($res,get_sub_list($filter, array("server"), get_ou("serverou"), 
+        get_ou("systemsou").$sysfilter['depselect'],          array("cn"), GL_SUBSEARCH | GL_SIZELIMIT));
+    $res= array_merge($res,get_sub_list($filter, array("workstation"), get_ou("workstationou"),
+        get_ou("systemsou").$sysfilter['depselect'],          array("cn"), GL_SUBSEARCH | GL_SIZELIMIT));
 
-    $res= get_sub_list($filter, array("terminal","server","workstation"), $deps_a, 
-        get_ou("systemsou").$sysfilter['depselect'],          array("cn"), GL_SUBSEARCH | GL_SIZELIMIT);
     $wslist= array();
     foreach ($res as $attrs){
       $wslist[]= preg_replace('/\$/', '', $attrs['cn'][0]);
@@ -579,7 +590,8 @@ class sudo extends plugin
             "sudoUser"          => _("Users"),
             "sudoHost"          => _("Host"),
             "sudoCommand"       => _("Command"),
-            "sudoRunAs"         => _("Run as user"))
+            "sudoRunAs"         => _("Run as user"),
+            "trustModel"        => _("Access control list"))
         ));
   }
 }
index 2437da5fb47cf6644050270173b0bdb1d90764ec..e46b946f889bd330725b9dde84d783a47811c913 100644 (file)
@@ -101,7 +101,12 @@ class target_list_systems extends MultiSelectWindow
     }
 
     /* Load possible departments */
-    $tdeps= $ui->get_module_departments(array("server","terminal","workstation"));
+    $tdeps= array();
+    $tdeps= array_merge($tdeps,$ui->get_module_departments("server"));
+    $tdeps= array_merge($tdeps,$ui->get_module_departments("terminal"));
+    $tdeps= array_merge($tdeps,$ui->get_module_departments("workstation"));
+    $tdeps = array_unique($tdeps); 
     $ids = $this->config->idepartments;
     $first = "";
     $found = FALSE;
@@ -225,37 +230,48 @@ class target_list_systems extends MultiSelectWindow
     $filter   = "";
     $Regex    = $this->Regex;
 
-    $chk = array(
-        "terminal"     => "(objectClass=gotoTerminal)",
-        "server"       => "(objectClass=goServer)" ,
-        "workstation"  => "(objectClass=gotoWorkstation)");
-
-    /* Create filter */
-    foreach($chk as $chkBox => $FilterPart){
-      if($this->$chkBox){
-        $filter .=  $FilterPart;
-      }
-    }
     $filter= "(&(cn=".$Regex.")(|".$filter."))";
 
     if($this->SubSearch){
-      $res= get_list($filter, array("terminal","workstation","server"), $base, 
-            array("cn","objectClass","gosaGroupObjects","description"), GL_SIZELIMIT | GL_SUBSEARCH);
+      $res= array();
+      if($this->terminal){
+        $filter = "(objectClass=gotoTerminal)";
+        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_sub_list($filter,"terminal",get_ou('terminalou'),$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
+      }
+      if($this->workstation){
+        $filter = "(objectClass=gotoWorkstation)";  
+        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_sub_list($filter, "workstation",  get_ou('workstationou'),$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
+      }
+      if($this->server){
+        $filter = "(objectClass=goServer)";
+        $filter = "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_sub_list($filter, "server", get_ou('serverou'),$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
+      }
     }else{
-      $res= get_list($filter, "terminal", get_ou('terminalou').$base, 
-            array("cn","objectClass","description"), GL_SIZELIMIT );
-      $res= array_merge($res,get_list($filter, "workstation",  get_ou('workstationou').$base, 
-            array("cn","objectClass","description"), GL_SIZELIMIT ));
-      $res= array_merge($res,get_list($filter, "server", get_ou('serverou').$base, 
-            array("cn","objectClass","description"), GL_SIZELIMIT ));
-
-      $deps_a = array(
-          get_ou("workstationou"),
-          get_ou("terminalou"),
-          get_ou("serverou"));
-
-      $res = get_sub_list($filter,array("server","terminal","workstation"), 
-                  $deps_a,get_ou("systemsou").$base,array("cn","objectClass","description"),GL_SIZELIMIT);
+      $res= array();
+      if($this->terminal){
+        $filter = "(objectClass=gotoTerminal)";
+        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_list($filter,"terminal", get_ou('terminalou').$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT ));
+      }
+      if($this->workstation){
+        $filter = "(objectClass=gotoWorkstation)";  
+        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_list($filter, "workstation",  get_ou('workstationou').$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT ));
+      }
+      if($this->server){
+        $filter = "(objectClass=goServer)";
+        $filter = "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_list($filter, "server", get_ou('serverou').$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT ));
+      }
     }
 
     $this->list= $res;