From a43059e5ce59378451f635b83be9afe7bf4388a8 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 8 Apr 2008 06:58:12 +0000 Subject: [PATCH] Updated sudo plugin -Fixed Add system/user acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10264 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../sudo/admin/sudo/class_sudoGeneric.inc | 26 +++++-- .../admin/sudo/class_target_list_systems.inc | 72 +++++++++++-------- 2 files changed, 63 insertions(+), 35 deletions(-) diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc index a7697f1bb..05a1a13d5 100644 --- a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc +++ b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc @@ -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")) )); } } diff --git a/gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc b/gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc index 2437da5fb..e46b946f8 100644 --- a/gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc +++ b/gosa-plugins/sudo/admin/sudo/class_target_list_systems.inc @@ -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; -- 2.30.2