summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 73e29fb)
raw | patch | inline | side by side (parent: 73e29fb)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 6 Oct 2006 08:33:56 +0000 (08:33 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 6 Oct 2006 08:33:56 +0000 (08:33 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4867 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_faiScript.inc | patch | blob | history |
index 24d04753449c0608bdb1fdb7fbb316b78bd0c186..5516f19d5fe653dc8079e5e3d87516adab183272 100644 (file)
var $FAIstate ="";
+ var $ui;
+
function faiScript ($config, $dn= NULL)
{
/* Load Attributes */
$this->SubObjects[$objects['cn']] = $objects;
}
}
+ $this->ui = get_userinfo();
}
return($object);
}
+ function acl_base_for_current_object($dn)
+ {
+ if($dn == "new"){
+ if($this->dn == "new"){
+ $dn= $_SESSION['CurrentMainBase'];
+ }else{
+ $dn = $this->dn;
+ }
+ }
+ return($dn);
+ }
+
function execute()
{
/* Add new sub object */
if(isset($_POST['AddSubObject'])){
-
- $c_dn = $this->dn;
- if($c_dn == "new"){
- $c_dn = $_SESSION['CurrentMainBase'];
- }
-
$this->dialog= new $this->subClassName($this->config,"new");
- $this->dialog->set_acl_base($c_dn);
+ $this->dialog->set_acl_base($this->acl_base);
$this->dialog->set_acl_category("fai");
$this->is_dialog=true;
}
$_SESSION['objectinfo']= $this->dn;
}
-
/* New Listhandling
*/
$once = true;
$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");
$entry = preg_replace("/^deletescript_/","",$name);
$entry = base64_decode(preg_replace("/_.*/","",$entry));
-
- $dn = $this->SubObjects[$entry]['dn'];
-
- if($dn == "new"){
- $dn = $_SESSION['CurrentMainBase'];
- }
- $acl = $this->ui -> get_permissions($dn,"fai/faiScriptEntry") ;
-
+ $acl = $this->ui->get_permissions($this->acl_base_for_current_object($this->SubObjects[$entry]['dn']),"fai/faiScriptEntry") ;
if(preg_match("/d/",$acl)){
if(($this->SubObjects[$entry]['status'] == "edited")||($this->SubObjects[$entry]['status'] == "FreshLoaded")){
$this->SubObjects[$entry]['status']= "delete";
if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
$script = $_POST['SubObject'][0];
$this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$script]);
- $this->dialog->set_acl_base($_SESSION['CurrentMainBase']);
+ $this->dialog->set_acl_base($this->acl_base_for_current_object($this->SubObjects[$script]['dn']));
$this->dialog->set_acl_category("fai");
$_SESSION['objectinfo'] = $this->SubObjects[$script]['dn'];
$this->is_dialog=true;
$divlist->setHeight(400);
foreach($this->getList(true) as $key => $name){
- $dn= $name['dn'];
- if($dn == "new"){
- $dn = $_SESSION['CurrentMainBase'];
- }
- $ui = get_userinfo();
- $acl = $ui->get_permissions($dn,"fai/faiScriptEntry") ;
+ $dn= $this->acl_base_for_current_object($name['dn']);
+ $acl = $this->ui->get_permissions($dn,"fai/faiScriptEntry") ;
$act = "";
if($this->FAIstate == "freeze"){
}
}
- $s_acl = $ui->get_permissions($dn,"fai/faiScriptEntry","FAIscript") ;
+ $s_acl = $this->ui->get_permissions($dn,"fai/faiScriptEntry","FAIscript") ;
if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
$down = "";
}else{
}
}
+ $dn = $this->acl_base_for_current_object($this->dn);
+ $smarty->assign("sub_object_is_addable", preg_match("/c/",$this->ui->get_permissions($dn,"fai/faiScriptEntry")) && $this->FAIstate!="freeze");
$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");
foreach($tmp['plProvidedAcls'] as $name => $translated){
$smarty->assign($name."ACL",$this->getacl($name));
}
*/
function remove_from_parent()
{
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ($this->dn);
+ if($this->acl_is_removeable()){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd ($this->dn);
-# $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $this->dn);
- $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
- if($_SESSION['faifilter']['branch'] == "main"){
- $use_dn = $this->dn;
- }
-
- prepare_to_save_FAI_object($use_dn,array(),true);
-
- foreach($this->SubObjects as $name => $obj){
-# $use_dn = str_ireplace( get_release_dn($this->dn), $_SESSION['faifilter']['branch'], $obj['dn']);
- $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
+ $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $this->dn);
if($_SESSION['faifilter']['branch'] == "main"){
- $use_dn = $obj['dn'];
+ $use_dn = $this->dn;
}
+
prepare_to_save_FAI_object($use_dn,array(),true);
+
+ foreach($this->SubObjects as $name => $obj){
+ $use_dn = preg_replace("/".normalizePreg(get_release_dn($this->dn))."/i", $_SESSION['faifilter']['branch'], $obj['dn']);
+ if($_SESSION['faifilter']['branch'] == "main"){
+ $use_dn = $obj['dn'];
+ }
+ prepare_to_save_FAI_object($use_dn,array(),true);
+ }
+ $this->handle_post_events("remove");
}
- $this->handle_post_events("remove");
}