From: hickert Date: Mon, 2 Oct 2006 09:13:18 +0000 (+0000) Subject: Fixed divlist acls for fai X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=36f16785d3ea655858eadcf7f49224e720bf4ea7;p=gosa.git Fixed divlist acls for fai git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4843 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_divListFai.inc b/plugins/admin/fai/class_divListFai.inc index 58cd27a8e..9dea993f8 100644 --- a/plugins/admin/fai/class_divListFai.inc +++ b/plugins/admin/fai/class_divListFai.inc @@ -95,6 +95,7 @@ class divListFai extends MultiSelectWindow function GenHeader() { + $ui = get_userinfo(); /* Prepare departments, which are shown in the listbox on top of the listbox */ @@ -125,32 +126,34 @@ class divListFai extends MultiSelectWindow "  ". - "\"\" ". - - "  ". - "\"\" "; - $listhead .= $this->get_snapshot_header($this->selectedBase); - $listhead .= "  ". - "  ". + $acl = $ui->get_permissions($this->selectedBase,"fai/faiProfile"); + if(preg_match("/c/",$acl)){ + $listhead .="  "; + } - "  ". + $listhead .= "\"\" "; + $listhead .= $this->get_snapshot_header($this->selectedBase); - "  ". - "  ". + $arr = array( + array("images/fai_new_partitionTable.png" , _("New partition table") ,"Create_partition" , _("PT") , "faiPartitionTable"), + array("images/fai_new_script.png" , _("New scripts") ,"Create_script" , _("S") , "faiScript"), + array("images/fai_new_hook.png" , _("New hooks") ,"Create_hook" , _("H") , "faiHook"), + array("images/fai_new_variable.png" , _("New variables") ,"Create_variable" , _("V") , "faiVariable"), + array("images/fai_new_template.png" , _("New templates ") ,"Create_template" , _("I") , "faiTemplate"), + array("images/fai_new_packages.png" , _("New package list") ,"Create_package" , _("PK") , "faiPackage")); - "  ". + foreach($arr as $ar){ - "  ". + $acl = $ui->get_permissions($this->selectedBase,"fai/".$ar[4]); + if(preg_match("/c/",$acl)){ + $listhead .="  "; + } + } + $listhead .="  ". _("Base")." ". "  ". @@ -217,21 +220,28 @@ _("Submit")."'> ". $desc= ""; } + if($value['FAIstate'] == "freeze"){ - $action= ""; - $edi = $editlink; - $acti = $action; }else{ $action= ""; - $action.= $this->GetSnapShotActions($value['dn']);; - $action.= ""; - $acti = $action; - $edi = $editlink; + + if(preg_match("/(c&w)/",$value['acl'])){ + $action.= $this->GetSnapShotActions($value['dn']);; + } + + if(preg_match("/d/",$value['acl'])){ + $action.= ""; + } } + $edi = $editlink; + $acti = $action; + $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'"); $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$value['cn'].$desc,preg_replace('/ /', ' ', @LDAP::fix($value['dn']))),$edi) , "attach" => "style=''"); $field3 = array("string" => $info, "attach" => "style='width:200px;'"); diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 1bcc95816..098cde7ab 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -703,21 +703,28 @@ class faiManagement extends plugin $this->lock_type = get_release_tag(get_release_dn($base)); - /* Get resolved release dependencies */ - $tmp = get_all_objects_for_given_base($base,"(&(|(objectClass=FAIpartitionTable)(objectClass=FAIpackageList)(objectClass=FAIscript) - (objectClass=FAIvariable)(objectClass=FAIhook)(objectClass=FAIprofile)(objectClass=FAItemplate))(cn=$Regex))"); - /* Create a new list of FAI object * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ... */ $ObjectTypes = array( - "FAIpartitionTable" => array("OU"=>"ou=disk," , "CHKBOX"=>"ShowPartitions"), - "FAIpackageList" => array("OU"=>"ou=packages," , "CHKBOX"=>"ShowPackages"), - "FAIscript" => array("OU"=>"ou=scripts," , "CHKBOX"=>"ShowScripts"), - "FAIvariable" => array("OU"=>"ou=variables," , "CHKBOX"=>"ShowVariables"), - "FAIhook" => array("OU"=>"ou=hooks," , "CHKBOX"=>"ShowHooks"), - "FAIprofile" => array("OU"=>"ou=profiles," , "CHKBOX"=>"ShowProfiles"), - "FAItemplate" => array("OU"=>"ou=templates," , "CHKBOX"=>"ShowTemplates")); + "FAIpartitionTable" => array("OU"=>"ou=disk," , "CHKBOX"=>"ShowPartitions" ,"ACL" => "faiPartitionTable"), + "FAIpackageList" => array("OU"=>"ou=packages," , "CHKBOX"=>"ShowPackages" ,"ACL" => "faiPackage"), + "FAIscript" => array("OU"=>"ou=scripts," , "CHKBOX"=>"ShowScripts" ,"ACL" => "faiScript"), + "FAIvariable" => array("OU"=>"ou=variables," , "CHKBOX"=>"ShowVariables" ,"ACL" => "faiVariable"), + "FAIhook" => array("OU"=>"ou=hooks," , "CHKBOX"=>"ShowHooks" ,"ACL" => "faiHook"), + "FAIprofile" => array("OU"=>"ou=profiles," , "CHKBOX"=>"ShowProfiles" ,"ACL" => "faiProfile"), + "FAItemplate" => array("OU"=>"ou=templates," , "CHKBOX"=>"ShowTemplates" ,"ACL" => "faiTemplate")); + + $filter = ""; + foreach($ObjectTypes as $key => $data){ + if($this->DivListFai->$data['CHKBOX']){ + $filter.= "(objectClass=".$key.")"; + } + } + $filter = "(&(|".$filter.")(cn=$Regex))"; + + /* Get resolved release dependencies */ + $tmp = get_all_objects_for_given_base($base,$filter); /* Ge listed ldap objects */ $ldap = $this->config->get_ldap_link(); @@ -731,12 +738,9 @@ class faiManagement extends plugin /* Walk through possible types */ foreach($ObjectTypes as $type => $rest){ - /* Skip all unchecked types */ - if(! $this->DivListFai->$rest['CHKBOX']){ - continue; - } + $acl = $this->ui->get_permissions($object['dn'],"fai/".$rest ['ACL']); - if(in_array($type,$object['objectClass'])){ + if(in_array($type,$object['objectClass']) && preg_match("/r/",$acl)){ /* Prepare object */ unset($object['objectClass']['count']); @@ -748,6 +752,7 @@ class faiManagement extends plugin $obj = array(); $obj['cn'] = $object['cn'][0]; $obj['dn'] = $object['dn']; + $obj['acl'] = $acl; $obj['description'] = $object['description'][0]; $obj['objectClass'] = $object['objectClass'];