summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 990cfb5)
raw | patch | inline | side by side (parent: 990cfb5)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 26 Jan 2010 13:46:42 +0000 (13:46 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 26 Jan 2010 13:46:42 +0000 (13:46 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15328 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc | patch | blob | history |
diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc
index 9807677d14c1d5cdd6e8735f86d5cdf152715772..628da1b60ce85d51f5e51b0d9970c66a9223ab4a 100644 (file)
protected $trustModel = "";
private $is_default = FALSE;
- private $show_ws_dialog = FALSE;
private $was_trust_account= FALSE;
public $objectclasses = array("top","sudoRole");
public $orig_dn;
+ protected $trustSelect;
+
/*! \brief Returns to the base department for sudo roles.
This department is then used to store new roles.
@param Object GOsa configuration object.
/* 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 user workstation? */
- if (isset($_POST["add_ws_finish"]) && isset($_POST['wslist'])){
- foreach($_POST['wslist'] as $ws){
- $this->accessTo[$ws]= $ws;
+ // 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;
}
- ksort($this->accessTo);
- $this->is_modified= TRUE;
+ $this->trustSelect= NULL;
+ $this->dialog= FALSE;
}
+
/* Remove user workstations? */
if (isset($_POST["delete_ws"]) && isset($_POST['workstation_list'])){
foreach($_POST['workstation_list'] as $name){
/* Add user workstation finished? */
if (isset($_POST["add_ws_finish"]) || isset($_POST["add_ws_cancel"])){
- $this->show_ws_dialog= FALSE;
+ $this->trustSelect= NULL;
$this->dialog= FALSE;
}
/* Show ws dialog */
- if ($this->show_ws_dialog){
- return($this->display_trust_add_dialog());
+ if ($this->trustSelect){
+
+ // Build up blocklist
+ session::set('filterBlacklist', array('cn' => array_values($this->accessTo)));
+ return($this->trustSelect->execute());
}
}
- /*! \brief Display the System Trust Add Workstation dialog
- @return String HTML dialog to add a system to the trust list.
-
- */
- private function display_trust_add_dialog()
- {
- $smarty = get_smarty();
-
- /* 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'];
- $filter= "(&(|(objectClass=goServer)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))$exclude(cn=*)(cn=$regex))";
-
- $res = array();
- $res= array_merge($res,get_sub_list($filter, array("terminal"), get_ou("terminalRDN"),
- get_ou("systemRDN").$sysfilter['depselect'], array("cn"), GL_SUBSEARCH | GL_SIZELIMIT));
- $res= array_merge($res,get_sub_list($filter, array("server"), get_ou("serverRDN"),
- get_ou("systemRDN").$sysfilter['depselect'], array("cn"), GL_SUBSEARCH | GL_SIZELIMIT));
- $res= array_merge($res,get_sub_list($filter, array("workstation"), get_ou("workstationRDN"),
- 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);
- foreach( array("depselect","regex") as $type){
- $smarty->assign("$type", $sysfilter[$type]);
- }
- $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());
- $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);
- }
-
-
/*! \brief Force this entry to be handled and saved as 'default'
@param BOOL TRUE -force defaults FALSE -normal
*/