X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_divListSystem.inc;h=488e882f66c4aebc76d4957a47c35573cebcac3c;hb=9695395f399e680d3fbb0c6b7a2df7d8b37d17c8;hp=b58169262f276e3faa9c0676a3cad729f78edfcb;hpb=543a94fb8acb261e60a144b969ee50d169592fbc;p=gosa.git diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc index b58169262..488e882f6 100644 --- a/plugins/admin/systems/class_divListSystem.inc +++ b/plugins/admin/systems/class_divListSystem.inc @@ -28,8 +28,12 @@ class divListSystem extends MultiSelectWindow function divListSystem ($config,$parent) { - MultiSelectWindow::MultiSelectWindow($config,"System"); - + MultiSelectWindow::MultiSelectWindow($config, "System", array("server", + "workstation", + "terminal", + "phone", + "printer")); + $this->parent = $parent; $this->ui = get_userinfo(); @@ -42,15 +46,21 @@ class divListSystem extends MultiSelectWindow $this->SetInformation(_("This menu allows you to add, remove and change the properties of specific systems. You can only add systems which have already been started once.")); $this->EnableAplhabet (true); - + /* Disable buttonsm */ $this->EnableCloseButton(false); $this->EnableSaveButton (false); + /* Dynamic action col, depending on snapshot icons */ + $action_col_size = 70; + if($this->parent->snapshotEnabled()){ + $action_col_size += 38; + } + /* set Page header */ $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'")); $this->AddHeader(array("string"=>_("System / Department"))); - $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:60px;border-right:0px;'")); + $this->AddHeader(array("string"=>_("Actions"),"attach"=>"style='width:".$action_col_size."px;border-right:0px;'")); /* Text ,Value ,Name ,Is selected */ $this->AddCheckBox("ShowServers", _("Select to see servers"), _("Show servers"), true); @@ -72,43 +82,112 @@ class divListSystem extends MultiSelectWindow function GenHeader() { - /* Prepare departments, + /* Prepare departments, which are shown in the listbox on top of the listbox */ $options= ""; - foreach ($this->config->idepartments as $key => $value){ - if ($this->selectedBase == $key){ - $options.= ""; - } else { - $options.= ""; + + /* Get all departments within this subtree */ + $base = $this->config->current['BASE']; + $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base, + array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH); + + $tmp =array(); + foreach($deps as $dep){ + $tmp[$dep['dn']] = $dep; + } + $deps = $tmp; + + /* Load possible departments */ + $ui= get_userinfo(); + $department = array(); + foreach($this->module as $module){ + $d = $ui->get_module_departments($module); + foreach($d as $department){ + $departments[$department] = $department; + } + } + + $ids = $this->config->idepartments; + + foreach($deps as $dep){ + if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $departments)){ + + $value = $ids[$dep['dn']]; + if ($this->selectedBase == $dep['dn']){ + $options.= ""; + } else { + $options.= ""; + } } } - $listhead = "
". - "  ". - "  ". - "  ". - "  ". - "  ". - " ". - " ". - " ". - " ". - " ". - " ". - "  "._("Base")." ". - " ". - "  ". - "
"; + + /* If there is at least one c (Create) and one w (Write) acl in this combination + display the snapshot paste icon. BUT check the correct acls in the management plugin */ + $all_module_acls = ""; + foreach($this->module as $module){ + $all_module_acls .= $ui->has_complete_category_acls($this->selectedBase,$module); + } + + /* Must we add an additional seperator */ + $add_sep = false; + + /* Add default header */ + $listhead = MultiSelectWindow::get_default_header(); + + /* Add snapshot icons */ + if(preg_match("/(c.*w|w.*c)/",$all_module_acls)){ + $listhead .= $this->get_snapshot_header($this->selectedBase); + $add_sep = true; + } + + /* Handle create icons */ + if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"terminal/termgeneric"))){ + $add_sep = true; + $listhead .= " "; + } + + if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){ + $add_sep = true; + $listhead .= " "; + } + + if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"server/servgeneric"))){ + $add_sep = true; + $listhead .= " "; + } + + if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){ + $add_sep = true; + $listhead .= " "; + } + + if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"phone/phoneGeneric"))){ + $add_sep = true; + $listhead .= " "; + } + + if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){ + $add_sep = true; + $listhead .= " "; + } + + /* Should we add a seperator ? */ + if($add_sep){ + $listhead .= " "; + } + + /* Add base selection */ + $listhead .= _("Base")."  ". + "  ". + ""; $this->SetListHeader($listhead); } @@ -118,6 +197,7 @@ class divListSystem extends MultiSelectWindow $this->GenHeader(); } + function setEntries($terminals) { $img1 = "C"; @@ -131,16 +211,62 @@ class divListSystem extends MultiSelectWindow $img9 = "F"; $img10 = "L"; - $empty =" "; - $action= ""; - $action.= ""; + $empty =""; + + /* Dynamic action col, depending on snapshot icons */ + $action_col_size = 70; + if($this->parent->snapshotEnabled()){ + $action_col_size += 38; + } // User and Template Images $editlink = "%s"; + /* ACL mapping */ + $ui = get_userinfo(); + $tabs = array( + "terminal" => array("CLASS"=>"TERMTABS", "TABCLASS" =>"termtabs", "ACL"=> "terminal/termgeneric"), + "workstation" => array("CLASS"=>"WORKTABS", "TABCLASS" =>"worktabs", "ACL"=> "workstation/workgeneric"), + "server" => array("CLASS"=>"SERVTABS", "TABCLASS" =>"servtabs", "ACL"=> "server/servgeneric"), + "printer" => array("CLASS"=>"PRINTTABS", "TABCLASS" =>"printtabs", "ACL"=> "printer/printgeneric"), + "phone" => array("CLASS"=>"PHONETABS", "TABCLASS" =>"phonetabs", "ACL"=> "phone/phoneGeneric"), + "winstation" => array("CLASS"=>"WINTABS", "TABCLASS" =>"wintabs", "ACL"=> "winworkstation/wingeneric"), + "component" => array("CLASS"=>"COMPONENTTABS","TABCLASS" =>"componenttabs", "ACL"=> "component/componentGeneric")); + + // Test Every Entry and generate divlist Array foreach($terminals as $key => $val){ - + + /* Get system type, it is used to fetch the acls for the current object. + "winstation" acls are stored as 2winworkstation", so we have to map this here */ + $type = $this->parent->get_system_type($val['objectClass']); + if($type == "winstation") { + $acl_type = "winworkstation"; + }else{ + $acl_type = $type; + } + + /* Get complete category acls */ + $acl_all = $ui->has_complete_category_acls($val['dn'],$acl_type) ; + + /* Get specific generic acls */ + $acl = $ui->get_permissions($val['dn'],$tabs[$type]['ACL']); + + $action= ""; + if(preg_match("/(c.*w|w.*c)/",$acl_all)){ + $action.= $this->GetSnapShotActions($val['dn']); + }else{ + $action.= $empty." ".$empty." "; + } + + if(preg_match("/d/",$acl)){ + $action.= ""; + }else{ + $action.= $empty; + } + /* Generate picture list, which is currently disabled */ if(in_array("goCupsServer" ,$val['objectClass'])) $cups = $img1; else $cups =$empty; if(in_array("goLogDBServer" ,$val['objectClass'])) $logdb = $img2; else $logdb =$empty; @@ -152,7 +278,7 @@ class divListSystem extends MultiSelectWindow if(in_array("goFonServer" ,$val['objectClass'])) $fon = $img8; else $fon =$empty; if(in_array("goFaxServer" ,$val['objectClass'])) $fax = $img9; else $fax =$empty; if(in_array("goLdapServer" ,$val['objectClass'])) $ldap = $img10; else $ldap =$empty; - + $pics = $cups.$logdb.$syslog.$imap.$samba.$nfs.$krb.$fon.$fax.$ldap; $pics = ""; // Pictures currently hidden @@ -169,34 +295,55 @@ class divListSystem extends MultiSelectWindow $display= $val["cn"][0].$dsc; } - if((in_array("gotoTerminal",$val['objectClass']))||(in_array("gotoWorkstation",$val['objectClass']))){ - $action2 = ""; + + /* Check if this is a terminal/workstation && if we are allowed to change the gotoRootPasswd */ + $pwd_acl =""; + if(in_array("gotoWorkstation",$val['objectClass'])){ + $pwd_acl = $ui->get_permissions($val['dn'],"workstation/workgeneric","gotoRootPasswd"); + } + if(in_array("gotoTerminal",$val['objectClass'])){ + $pwd_acl = $ui->get_permissions($val['dn'],"terminal/termgeneric","gotoRootPasswd"); + } + if(preg_match("/w/",$pwd_acl)){ + $action2 = ""; }else{ - $action2 = ""; + $action2 = $empty; + } + + + if(in_array("gotoWorkstation",$val['objectClass'])){ + $action2= " ".$action2; + }else{ + $action2= $empty.$action2; } if(isset($val['message'])){ - $display.= " (".$val['message']." '".$this->config->idepartments[$_SESSION['CurrentMainBase']]."' )"; + $display.= " (".$val['message'].")"; } $img = $this->parent->convert_list($val); $field1 = array("string" => sprintf($img['img'],$val['dn']), "attach" => "style='text-align:center;width:20px;'"); $field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', ' ', @LDAP::fix($val['dn']))."'"); - $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:60px;border-right:0px;text-align:right;'"); + $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"); $this->AddElement( array($field1,$field2,$field3)); } } + function Save() { MultiSelectWindow :: Save(); } + function save_object() { /* Save automatic created POSTs like regex, checkboxes */ - MultiSelectWindow :: save_object(); + MultiSelectWindow :: save_object(); + + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: