diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc
index ef83d1c84952c19d0a2251468ba7603e674c51a2..3f968dc9f11498a60a683f8918cd8f5570c7658f 100644 (file)
/* Array with available class names */
var $FAIAllclasses = array();
+ var $ui;
function faiProfileEntry ($config, $dn= NULL,$used=array(),$objects=false)
{
plugin::plugin ($config, $dn);
/* Search only in fai tree */
- $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base'];
+ $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+
+ $this->ui = get_userinfo();
/* Create array with categories to be able to sort different types of objects */
- $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackage");
+ $categories = array("FAIscript" => "faiScript",
+ "FAItemplate" => "faiTemplate",
+ "FAIhook" => "faiHook",
+ "FAIvariable" => "faiVariable",
+ "FAIpartitionTable" => "faiPartitionTable",
+ "FAIpackageList" => "faiPackageList");
/* Read out all objects from fai tree */
$ldap= $this->config->get_ldap_link();
$ldap->cd($base);
$ldap->search("(| (objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)(objectClass=FAIvariable)
- (objectClass=FAIpartitionTable)(objectClass=FAIpackage))",array("*"));
+ (objectClass=FAIpartitionTable)(objectClass=FAIpackageList))",array("*"));
$sort=array();
while($attrs = $ldap->fetch()){
/* Only use objects which have cn set */
if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
- foreach($categories as $cat){
+ foreach($categories as $cat => $acl){
if(in_array($cat,$attrs['objectClass'])){
+ $acl = $this->ui->get_permissions($attrs['dn'],"fai/".$acl);
+
/* Append different types of objects */
$this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat;
+
+ if(!isset($this->FAIAllclasses[$attrs['cn'][0]]['acl'])){
+ $this->FAIAllclasses[$attrs['cn'][0]]['acl']="";
+ }
+ $this->FAIAllclasses[$attrs['cn'][0]]['acl'].=$acl;
/* Set selected status to false */
$this->FAIAllclasses[$attrs['cn'][0]]['status']=false;
}
}
}
+
+
$tmp = array();
ksort($sort);
foreach($sort as $name){
$this->FAIAllclasses = array();
$this->FAIAllclasses = $tmp;
-
/* If no search filter is set, create one */
if (!is_global("SUBfaifilter")){
- $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base, "Sregex" => "*");
- $SUBfaifilter['SShowTemplates'] = false;
- $SUBfaifilter['SShowScripts'] = false;
- $SUBfaifilter['SShowHooks'] = false;
- $SUBfaifilter['SShowVariables'] = false;
- $SUBfaifilter['SShowPackages'] = false;
- $SUBfaifilter['SShowPartitions']= false;
+ $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'], "Sregex" => "*");
+ $SUBfaifilter['SShowTemplates'] = true;
+ $SUBfaifilter['SShowScripts'] = true;
+ $SUBfaifilter['SShowHooks'] = true;
+ $SUBfaifilter['SShowVariables'] = true;
+ $SUBfaifilter['SShowPackages'] = true;
+ $SUBfaifilter['SShowPartitions']= true;
register_global("SUBfaifilter", $SUBfaifilter);
}
}
function execute()
{
+ /* Call parent execute */
+ plugin::execute();
+
/* Fill templating stuff */
$smarty = get_smarty();
$display = "";
/* Check if we used a checkboxe from the list, to select dselect an entry */
foreach($_POST as $name => $value){
foreach($this->FAIAllclasses as $class => $obj){
- if(isset($_POST["ON_PAGE_".$class])){
- if(isset($_POST['USE_'.$class])){
+ $bclass = base64_encode($class);
+ if(isset($_POST["ON_PAGE_".$bclass])){
+ if(isset($_POST['USE_'.$bclass])){
$this->FAIAllclasses[$class]['status']=true;
}else{
$this->FAIAllclasses[$class]['status']=false;
}
/* Create different picture for each object type */
- $objTypes['FAIhook'] = "<image src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''> ";
- $objTypes['FAItemplate'] = "<image src='images/fai_template.png' title='"._("Template bundle")."' alt=''> ";
- $objTypes['FAIscript'] = "<image src='images/fai_script.png' title='"._("Script bundle")."' alt=''> ";
- $objTypes['FAIvariable'] = "<image src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''> ";
- $objTypes['FAIpackages'] = "<image src='images/fai_packages.png' title='"._("Package bundle")."' alt=''> ";
- $objTypes['FAIpartitionTable'] = "<image src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''> ";
+ $objTypes['FAIhook'] = "<img src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''> ";
+ $objTypes['FAItemplate'] = "<img src='images/fai_template.png' title='"._("Template bundle")."' alt=''> ";
+ $objTypes['FAIscript'] = "<img src='images/fai_script.png' title='"._("Script bundle")."' alt=''> ";
+ $objTypes['FAIvariable'] = "<img src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''> ";
+ $objTypes['FAIpackageList'] = "<img src='images/fai_packages.png' title='"._("Package bundle")."' alt=''> ";
+ $objTypes['FAIpartitionTable'] = "<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''> ";
/* Magic quotes GPC, escapes every ' " \, to solve some security risks
* If we post the escaped strings they will be escaped again
/* Create a divlist to display all available class names with the depending object types */
$divlist = new divlist("ProfileEntry");
$divlist->SetSummary(_("This list displays all assigned class names for this profile."));
- $divlist->SetEntriesPerPage(20);
- $divlist->SetHeader(array(array("string"=>"Class name"),
- array("string"=>"Objects")));
+ $divlist->SetEntriesPerPage(0);
+ $divlist->SetHeader(array(array("string"=> _("Class name")),
+ array("string"=> _("Objects"),"attach"=>"style='border-right:0px;'")));
/* Action button allows us to delete an entry */
$action = "<input type='hidden' name='ON_PAGE_%KEY%' value='1'>
- <input type='checkbox' name='USE_%KEY%' value='%KEY%' onChange='document.mainform.submit();' %CHECK%>";
+ <input type='checkbox' name='USE_%KEY%' value='%KEY%' onClick='document.mainform.submit();' %CHECK%>";
/* Check every single class name to match the current search filter */
foreach($this->FAIAllclasses as $usedClass => $classes){
+ /* Skip those entries that we are not allowed to read. */
+ if(!preg_match("/r/",$classes['acl'])){
+ continue;
+ }
+
$fi = str_replace("*",".*",$SUBfaifilter['Sregex']);
- $abort = false;
+ $abort = true;
if(!preg_match("/".$fi."/",$usedClass)){
- $abort = true;
+ $abort = false;
}
- if(($SUBfaifilter['SShowScripts'])&&(!in_array('FAIscript',$classes['objects']))){
- $abort = true;
+ if((isset($classes['objects']['FAIscript']))&&($SUBfaifilter['SShowScripts'])){
+ $abort = false;
}
- if(($SUBfaifilter['SShowTemplates'])&&(!in_array('FAItemplate',$classes['objects']))){
- $abort = true;
+ if((isset($classes['objects']['FAItemplate']))&&($SUBfaifilter['SShowTemplates'])){
+ $abort = false;
}
- if(($SUBfaifilter['SShowHooks'])&&(!in_array('FAIhook',$classes['objects']))){
- $abort = true;
+ if((isset($classes['objects']['FAIhook']))&&($SUBfaifilter['SShowHooks'])){
+ $abort = false;
}
- if(($SUBfaifilter['SShowVariables'])&&(!in_array('FAIvariable',$classes['objects']))){
- $abort = true;
+ if((isset($classes['objects']['FAIvariable']))&&($SUBfaifilter['SShowVariables'])){
+ $abort = false;
}
- if(($SUBfaifilter['SShowPartitions'])&&(!in_array('FAIpartitionTable',$classes['objects']))){
- $abort = true;
+ if((isset($classes['objects']['FAIpartitionTable']))&&($SUBfaifilter['SShowPartitions'])){
+ $abort = false;
}
- if(($SUBfaifilter['SShowPackages'])&&(!in_array('FAIpackages',$classes['objects']))){
- $abort = true;
+ if((isset($classes['objects']['FAIpackageList']))&&($SUBfaifilter['SShowPackages'])){
+ $abort = false;
}
if(!$abort){
}
/* Append to list */
- $field1 = array("string"=> preg_replace("/%KEY%/",$usedClass,$action_check).$usedClass,"attach"=>"");
- $field2 = array("string"=> $str,"attach"=>"");
+ $field1 = array("string"=> str_replace("%KEY%",base64_encode($usedClass),$action_check).$usedClass,"attach"=>"");
+ $field2 = array("string"=> $str,"attach"=>"style='border-right:0px;'");
$divlist->AddEntry(array($field1,$field2));
}
}
$smarty->assign("faihead" , "");
$smarty->assign("failist" , $divlist->DrawList());
- $smarty->assign("infoimage" , get_template_path('images/info.png'));
- $smarty->assign("launchimage" , get_template_path('images/launch.png'));
+ $smarty->assign("infoimage" , get_template_path('images/info_small.png'));
+ $smarty->assign("launchimage" , get_template_path('images/small_filter.png'));
$smarty->assign("alphabet" , generate_alphabet());
$smarty->assign("apply" , apply_filter(TRUE));
$smarty->assign("search_image" , get_template_path('images/search.png'));
/* Check supplied data */
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
return ($message);
}