From: hickert Date: Thu, 2 Nov 2006 11:07:11 +0000 (+0000) Subject: Fixed fax acls X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8ecfbbfb5ea474890d7d46bb8aefea20135b226c;p=gosa.git Fixed fax acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4996 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/functions.inc b/include/functions.inc index 286e0a18b..376d19d86 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1182,12 +1182,7 @@ function get_printer_list($cups_server) /* Merge in printers from LDAP */ $ldap= $config->get_ldap_link(); $ldap->cd ($config->current['BASE']); - $ui= get_userinfo(); - if (preg_match('/TRUE/i', $config->current['STRICT_UNITS']) && $ui->gosaUnitTag != ""){ - $ldap->search('((objectClass=gotoPrinter)(gosaUnitTag='.$ui->gosaUnitTag.'))', array('cn')); - } else { - $ldap->search('(objectClass=gotoPrinter)', array('cn')); - } + $ldap->search('(objectClass=gotoPrinter)', array('cn')); return $res; } diff --git a/plugins/gofax/faxaccount/class_gofaxAccount.inc b/plugins/gofax/faxaccount/class_gofaxAccount.inc index f96b9ab20..69dc4acab 100644 --- a/plugins/gofax/faxaccount/class_gofaxAccount.inc +++ b/plugins/gofax/faxaccount/class_gofaxAccount.inc @@ -113,6 +113,9 @@ class gofaxAccount extends plugin } } + /* Edit mode specifies if we are editing from my accout */ + $edit_mode = (!is_object($this->parent) && !isset($_SESSION['edit'])); + /* Load smarty stuff */ $smarty= get_smarty(); @@ -157,7 +160,7 @@ class gofaxAccount extends plugin /* Trigger Add local fax alternatives dialog */ if (isset($_POST['add_local_alternate'])){ - if($this->acl_is_writeable("facsimileAlternateTelephoneNumber")){ + if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){ $this->locals_dialog= TRUE; $this->dialog= TRUE; } @@ -165,7 +168,7 @@ class gofaxAccount extends plugin /* Add alternatives from dialog */ if (isset($_POST['add_locals_finish']) && isset($_POST['local_list'])){ - if($this->acl_is_writeable("facsimileAlternateTelephoneNumber")){ + if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){ foreach ($_POST['local_list'] as $val){ $this->addAlternate($val); $this->is_modified= TRUE; @@ -175,14 +178,14 @@ class gofaxAccount extends plugin /* Add alternatives */ if (isset($_POST['add_alternate']) && !empty($_POST['forward_address']) && is_phone_nr($_POST['forward_address'])){ - if($this->acl_is_writeable("facsimileAlternateTelephoneNumber")){ + if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){ $this->addAlternate($_POST['forward_address']); } } /* Delete alternate fax number */ if (isset($_POST['delete_alternate']) && isset($_POST['alternate_list']) && count($_POST['alternate_list'])){ - if($this->acl_is_writeable("facsimileAlternateTelephoneNumber")){ + if($this->acl_is_writeable("facsimileAlternateTelephoneNumber",$edit_mode)){ $this->delAlternate ($_POST['alternate_list']); } } @@ -190,7 +193,7 @@ class gofaxAccount extends plugin /* Edit incoming blocklists */ if (isset($_POST['edit_incoming'])){ - if($this->acl_is_writeable("goFaxRBlocklist")) { + if($this->acl_is_writeable("goFaxRBlocklist",$edit_mode)) { $this->current_blocklist= array_merge($this->goFaxRBlocklist,$this->goFaxRBlockgroups); sort($this->current_blocklist); reset($this->current_blocklist); @@ -563,7 +566,7 @@ class gofaxAccount extends plugin $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $acl => $desc){ - $smarty->assign($acl."ACL",$this->getacl($acl)); + $smarty->assign($acl."ACL",$this->getacl($acl,$edit_mode)); } /* Load checkboxes */ @@ -659,20 +662,21 @@ class gofaxAccount extends plugin /* Save data to object */ function save_object() { + $edit_mode = (!is_object($this->parent) && !isset($_SESSION['edit'])); if (isset($_POST['faxTab'])){ plugin::save_object(); $tmp = 0+$this->goFaxDeliveryMode; - if($this->acl_is_writeable("faxtomail")){ + if($this->acl_is_writeable("faxtomail",$edit_mode)){ if (isset($_POST["faxtomail"]) && $_POST["faxtomail"] == 1){ $tmp |= 32; }elseif($tmp & 32){ $tmp &= (!32); } } - if($this->acl_is_writeable("faxtoprinter")){ + if($this->acl_is_writeable("faxtoprinter",$edit_mode)){ if (isset($_POST["faxtoprinter"]) && $_POST["faxtoprinter"] == 1){ $tmp |= 64; }elseif($tmp & 64){ @@ -681,7 +685,7 @@ class gofaxAccount extends plugin } $this->goFaxDeliveryMode = $tmp; - if($this->acl_is_writeable("goFaxIsEnabled")){ + if($this->acl_is_writeable("goFaxIsEnabled",$edit_mode)){ if (isset($_POST["goFaxIsEnabled"]) && $_POST["goFaxIsEnabled"] == "1"){ $this->goFaxIsEnabled= "0"; } else { @@ -690,14 +694,16 @@ class gofaxAccount extends plugin } - if (isset($_POST['mail']) && $this->acl_is_writeable("faxtomail")){ + if (isset($_POST['mail']) && $this->acl_is_writeable("faxtomail",$edit_mode)){ $this->mail= $_POST['mail']; } /* Check if mail account is active and correct the internal reference to represent the current status. */ - if (isset($this->parent->by_object['mailAccount']->is_account)&&($this->parent->by_object['mailAccount']->is_account)){ - $this->has_mailAccount= TRUE; + if(isset($this->parent)){ + if (isset($this->parent->by_object['mailAccount']->is_account)&&($this->parent->by_object['mailAccount']->is_account)){ + $this->has_mailAccount= TRUE; + } } } diff --git a/plugins/gofax/faxaccount/main.inc b/plugins/gofax/faxaccount/main.inc index ab20ed675..0f1817415 100644 --- a/plugins/gofax/faxaccount/main.inc +++ b/plugins/gofax/faxaccount/main.inc @@ -1,4 +1,8 @@ dn)) != ""){ $_SESSION['back_plugin']= $plug; - gen_locked_message ($username, $ui->dn); - exit (); - } + $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit$/","/^plug$/"); + $lock_msg = gen_locked_message ($username, $ui->dn); + + }else{ - /* Lock the current entry */ - add_lock ($ui->dn, $ui->dn); - $_SESSION['dn']= $ui->dn; - $_SESSION['edit']= TRUE; + /* Lock the current entry */ + add_lock ($ui->dn, $ui->dn); + $_SESSION['dn']= $ui->dn; + $_SESSION['edit']= TRUE; + } } /* save changes to LDAP and disable edit mode */ @@ -60,7 +66,12 @@ if (!$remove_lock){ } /* Execute formular */ - $display= $gofaxAccount->execute (); + if($lock_msg){ + $display.= $lock_msg; + }else{ + $display.= $gofaxAccount->execute (); + } + $info= ""; /* Store changes in session */ @@ -72,7 +83,8 @@ if (!$remove_lock){ if (!$gofaxAccount->locals_dialog && !$gofaxAccount->out_blocklist_dialog && !$gofaxAccount->in_blocklist_dialog && - $gofaxAccount->is_account){ + $gofaxAccount->is_account && + empty($lock_msg)){ $display.= "

\n";