index d37c897ba33b8f0896c3fc0133c83d18ef10a1d8..926ce5ddaca39699bad3aa88c7acaeb1044f15b5 100644 (file)
var $SubObjects = array(); // All leafobjects of this object
var $FAIstate = "";
+ var $ui;
function faiHook ($config, $dn= NULL)
{
$ldap->cd ($this->dn);
$attrs_to_search = $this->subAttributes;
$attrs_to_search[] = "FAIstate";
- $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))", array("dn"));
+ $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))", $attrs_to_search);
while($object = $ldap->fetch()){
+
+ /* Skip objects, that are tagged as removed */
+ if(isset($object['FAIstate'][0])){
+ if(preg_match("/removed$/",$object['FAIstate'][0])){
+ continue;
+ }
+ }
+
/* Set status for save management */
$objects = array();
$objects['status'] = "FreshLoaded";
$this->SubObjects[$objects['cn']] = $objects;
}
}
+ $this->ui = get_userinfo();
}
}
+ function acl_base_for_current_object($dn)
+ {
+ if($dn == "new"){
+ if($this->dn == "new"){
+ $dn= $_SESSION['CurrentMainBase'];
+ }else{
+ $dn = $this->dn;
+ }
+ }
+ return($dn);
+ }
+
+
function getUsedFAItask($cn)
{
$ret = array();
if($obj['status'] == "FreshLoaded"){
$obj = $this->get_object_attributes($obj,$this->sub_Load_Later);
}
+
$this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
- $this->dialog->set_acl_base($this->dn);
+ $this->dialog->set_acl_base($this->acl_base_for_current_object($obj['dn']));
$this->dialog->set_acl_category("fai");
$_SESSION['objectinfo'] = $obj['dn'];
$this->is_dialog=true;
}
if(preg_match("/^deletescript_/",$name)&&($once)){
- $once = false;
$entry = preg_replace("/^deletescript_/","",$name);
$entry = base64_decode(preg_replace("/_.*/","",$entry));
- if(($this->SubObjects[$entry]['status'] == "edited")||($this->SubObjects[$entry]['status'] == "FreshLoaded")){
- $this->SubObjects[$entry]['status']= "delete";
- }else{
- unset($this->SubObjects[$entry]);
+ $dn = $this->acl_base_for_current_object($this->SubObjects[$entry]['dn']);
+ $acl = $this->ui -> get_permissions($dn,"fai/faiScriptEntry") ;
+
+ if(preg_match("/d/",$acl)){
+ $once = false;
+
+ if(($this->SubObjects[$entry]['status'] == "edited")||($this->SubObjects[$entry]['status'] == "FreshLoaded")){
+ $this->SubObjects[$entry]['status']= "delete";
+ }else{
+ unset($this->SubObjects[$entry]);
+ }
}
}
}
/* Add new sub object */
if(isset($_POST['AddSubObject'])){
- $c_dn = $this->dn;
- if($c_dn == "new"){
- $c_dn = $_SESSION['CurrentMainBase'];
- }
-
+ $c_dn = $this->acl_base_for_current_object($this->dn);
$this->dialog= new $this->subClassName($this->config,"new");
$this->dialog->set_acl_base($c_dn);
$this->dialog->set_acl_category("fai");
$divlist = new divSelectBox("FAIhooks");
$divlist->setHeight(400);
- if($this->FAIstate == "freeze"){
- $img_edit = "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("edit")."' alt='"._("edit")."'>";
- $img_remo = "";
- }else{
- $img_edit = "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("edit")."' alt='"._("edit")."'>";
- $img_remo = "<input type='image' src='images/edittrash.png' name='deletescript_%s' title='"._("delete")."' alt='"._("delete")."'>";
- }
foreach($this->getList(true) as $key => $name){
- if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new")){
+ $dn= $this->acl_base_for_current_object($name['dn']);
+ $acl = $this->ui->get_permissions($dn,"fai/faiHookEntry") ;
+ $act = "";
+
+ /* Check if this object is freezed, in this case hide the delete icon */
+ if($this->FAIstate == "freeze"){
+ $act .= "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("edit")."' alt='"._("edit")."'>";
+ }else{
+ $act .= "<input type='image' src='images/edit.png' name='editscript_%s' title='"._("edit")."' alt='"._("edit")."'>";
+ if(preg_match("/d/",$acl)){
+ $act .="<input type='image' src='images/edittrash.png' name='deletescript_%s' title='"._("delete")."' alt='"._("delete")."'>";
+ }
+ }
+
+ /* Check if we are allowed to use the export button for this object */
+ $s_acl = $this->ui->get_permissions($dn,"fai/faiHookEntry","FAIscript") ;
+ if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
$down = "";
}else{
$down = "<a href='getFAIscript.php?id=".base64_encode($name['dn'])."'>
</a>";
}
- $divlist->AddEntry(array( array("string"=>$name['name']),
- array("string"=>$down , "attach" => "style='width:20px;'"),
- array("string"=>str_replace("%s",base64_encode($key),$img_edit.$img_remo),
- "attach"=>"style='border-right: 0px;width:50px;text-align:right;'")));
+ /* Check if we are allowed to view the object */
+ $s_acl = $this->ui->get_permissions($dn,"fai/faiHookEntry","cn") ;
+ if(preg_match("/r/",$s_acl)){
+ $divlist->AddEntry(array( array("string"=>$name['name']),
+ array("string"=>$down , "attach" => "style='width:20px;'"),
+ array("string"=>str_replace("%s",base64_encode($key),$act),
+ "attach"=>"style='border-right: 0px;width:50px;text-align:right;'")));
+ }
}
$smarty->assign("Entry_divlist",$divlist->DrawList());
/* Divlist creation complete
}
$tmp = $this->plInfo();
- $this->ui = get_userinfo();
- $c_dn = $this->dn;
- if($c_dn == "new"){
- $c_dn = $_SESSION['CurrentMainBase'];
- }
-
- $smarty->assign("sub_object_is_addable", preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiScriptEntry")) && $this->FAIstate!="freeze");
+ $c_dn = $this->acl_base_for_current_object($this->dn);
+ $smarty->assign("sub_object_is_addable", preg_match("/c/",$this->ui->get_permissions($c_dn,"fai/faiHookEntry")) && $this->FAIstate!="freeze");
foreach($tmp['plProvidedAcls'] as $name => $translation){
$smarty->assign($name."ACL",$this->getacl($name));
}