From: hickert Date: Tue, 26 Jan 2010 13:50:57 +0000 (+0000) Subject: Updated groups to use new accessTo dialog X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1ee672b235d10f17c5a1bd1efdb7ffcb89508421;p=gosa.git Updated groups to use new accessTo dialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15330 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/groups/class_groupGeneric.inc b/gosa-core/plugins/admin/groups/class_groupGeneric.inc index 82fed9121..184b27ae7 100644 --- a/gosa-core/plugins/admin/groups/class_groupGeneric.inc +++ b/gosa-core/plugins/admin/groups/class_groupGeneric.inc @@ -63,7 +63,7 @@ class group extends plugin */ var $accessTo= array(); var $trustModel= ""; - var $show_ws_dialog = FALSE; + var $trustSelect = FALSE; /* attribute list for save action */ var $attributes= array("cn", "description", "gidNumber","memberUid","sambaGroupType","sambaSID","accessTo","trustModel"); @@ -309,10 +309,28 @@ class group extends plugin /* Add user workstation? */ if (isset($_POST["add_ws"])){ - $this->show_ws_dialog= TRUE; + $this->trustSelect= new trustSelect($this->config,get_userinfo()); $this->dialog= TRUE; } + // Add selected machines to trusted ones. + if (isset($_POST["add_ws_finish"]) && $this->trustSelect){ + $trusts = $this->trustSelect->detectPostActions(); + if(isset($trusts['targets'])){ + + $headpage = $this->trustSelect->getHeadpage(); + foreach($trusts['targets'] as $id){ + $attrs = $headpage->getEntry($id); + $this->accessTo[$attrs['cn'][0]]= $attrs['cn'][0]; + } + ksort($this->accessTo); + $this->is_modified= TRUE; + } + $this->trustSelect= NULL; + $this->dialog= FALSE; + } + + /* Add user workstation? */ if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){ foreach($_POST['wslist'] as $ws){ @@ -331,76 +349,21 @@ class group extends plugin } /* Add user workstation finished? */ - if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){ - $this->show_ws_dialog= FALSE; + if (isset($_POST["add_ws_cancel"])){ + $this->trustSelect= NULL; $this->dialog= FALSE; } - $smarty= get_smarty(); /* Show ws dialog */ - if ($this->show_ws_dialog){ - - /* Save data */ - $sysfilter= session::get("sysfilter"); - foreach( array("depselect", "regex") as $type){ - if (isset($_POST[$type])){ - $sysfilter[$type]= $_POST[$type]; - } - } - if (isset($_GET['search'])){ - $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*"; - if ($s == "**"){ - $s= "*"; - } - $sysfilter['regex']= $s; - } - session::set("sysfilter", $sysfilter); - - /* Get workstation list */ - $exclude= ""; - foreach($this->accessTo as $ws){ - $exclude.= "(cn=$ws)"; - } - if ($exclude != ""){ - $exclude= "(!(|$exclude))"; - } - $regex= $sysfilter['regex']; - - /* Search for systems - */ - $types = array(); - $types['server'] = array("OU" => get_ou("serverRDN"), "OC" => "(objectClass=goServer)"); - $types['workstation'] = array("OU" => get_ou("workstationRDN"),"OC" => "(objectClass=gotoWorkstation)"); - $types['terminal'] = array("OU" => get_ou("terminalRDN"), "OC" => "(objectClass=gotoTerminal)"); - - $res = array(); - foreach($types as $acl => $data){ - $filter= "(&".$data['OC']."$exclude(cn=$regex))"; - $res= array_merge($res,get_sub_list($filter,array($acl),$data['OU'],get_ou("systemRDN").$sysfilter['depselect'], - array("cn"), GL_SUBSEARCH | GL_SIZELIMIT)); - } - $wslist = array(); - foreach ($res as $attrs){ - $wslist[]= preg_replace('/\$/', '', $attrs['cn'][0]); - } - - asort($wslist); - $smarty->assign("search_image", get_template_path('images/lists/search.png')); - $smarty->assign("launchimage", get_template_path('images/lists/action.png')); - $smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png')); - $smarty->assign("deplist", $this->config->idepartments); - $smarty->assign("alphabet", generate_alphabet()); - foreach( array("depselect", "regex") as $type){ - $smarty->assign("$type", $sysfilter[$type]); - } - $smarty->assign("hint", print_sizelimit_warning()); - $smarty->assign("wslist", $wslist); - $smarty->assign("apply", apply_filter()); - $display= $smarty->fetch (get_template_path('trust_machines.tpl', TRUE, dirname(__FILE__))); - return ($display); + if ($this->trustSelect){ + + // Build up blocklist + session::set('filterBlacklist', array('cn' => array_values($this->accessTo))); + return($this->trustSelect->execute()); } + $smarty= get_smarty(); if($this->config->search("nagiosaccount", "CLASS",array('menu'))){ $smarty->assign("nagios",true); }else{