summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 510bcb4)
raw | patch | inline | side by side (parent: 510bcb4)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 14 May 2008 12:01:47 +0000 (12:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 14 May 2008 12:01:47 +0000 (12:01 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10890 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc | patch | blob | history | |
gosa-plugins/gofon/gofon/macro/main.inc | patch | blob | history |
diff --git a/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc b/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc
index 9cfbe35ae1f0cf0744875cdda69677578cc30489..30c0319ddbe88f7a3fee3a4f4aef9682a792800c 100644 (file)
/* Call parent execute */
plugin::execute();
- session::set('LOCK_VARS_TO_USE',array("/^goFonMacro_/","/^act$/","/^id$/","/^item_selected/","/^remove_multiple_macros/"));
+ session::set('LOCK_VARS_TO_USE',array("/^menu_action/","/^goFonMacro_/","/^act$/","/^id$/","/^item_selected/","/^remove_multiple_macros/"));
/*****************
Variable initialisation
/* Cancel dialogs */
if (isset($_POST['edit_cancel'])){
- del_lock ($this->macrotabs->dn);
+ $this->remove_lock();
unset ($this->macrotabs);
$this->macrotabs= NULL;
session::un_set('objectinfo');
/* macro has been saved successfully, remove lock from
LDAP. */
if ($this->dn != "new"){
- del_lock ($this->dn);
+ $this->remove_lock();
}
unset ($this->macrotabs);
/* Lock the current entry, so everyone will get the
above dialog */
add_lock ($this->dn, $this->ui->dn);
+
/* Register macrotabs to trigger edit dialog */
$this->macrotabs= new macrotabs($this->config,
$this->config->data['TABS']['MACROTABS'], $this->dn,"gofonmacro");
if(count($ids)){
+ /* Collect dns */
foreach($ids as $id){
- $dn = $this->macros[$id]['dn'];
- if (($user= get_lock($dn)) != ""){
- return(gen_locked_message ($user, $dn));
- }
- $this->dns[$id] = $dn;
+ $this->dns[$id] = $this->macros[$id]['dn'];
+ }
+
+ /* Check locks */
+ if ($user= get_multiple_locks($this->dns)){
+ return(gen_locked_message($user,$this->dns));
}
$dns_names = array();
foreach($this->dns as $dn){
- add_lock ($dn, $this->ui->dn);
$dns_names[] = @LDAP::fix($dn);
}
+ /* Add entry locks */
+ add_lock ($this->dns, $this->ui->dn);
+
/* Lock the current entry, so nobody will edit it during deletion */
$smarty->assign("intro", msgPool::deleteInfo($dns_names,("macro")));
$smarty->assign("multiple", true);
msg_dialog::display(_("Permission error"),msgPool::permDelete(), ERROR_DIALOG);
}
- /* Remove lock file after successfull deletion */
- del_lock ($dn);
- unset($this->dns[$key]);
}
+
+ /* Remove lock file after successfull deletion */
+ $this->remove_lock();
+ $this->dns = array();
}
/* Remove lock */
if(isset($_POST['delete_multiple_macro_cancel'])){
- foreach($this->dns as $key => $dn){
- del_lock ($dn);
- unset($this->dns[$key]);
- }
+ $this->remove_lock();
+ $this->dns = array();
}
msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
new log("security","gofonmacro/".get_class($this),$this->dn,array(),"Tried to trick deletion.");
}
+
/* Remove lock file after successfull deletion */
- del_lock ($this->dn);
+ $this->remove_lock();
}
return($ids);
}
+ /*! \brief Remove entry locks if the plugin was aborted.
+ */
+ function remove_lock()
+ {
+ if($this->dn) del_lock($this->dn);
+ if(is_array($this->dns) && count($this->dns)) del_lock($this->dns);
+ }
function adapt_from_template($dn, $skip= array()) { }
function check() { }
index a47cab4ee17ebf715b8a58fa55a50fb9863b08fa..49fa2ef9b3dfa87d0ffe91be2bedb88f5c1e9d71 100644 (file)
if ($remove_lock){
if(session::is_set('macroManagement')){
- $macroManagment = session::get('macroManagment');
- $macroManagment->remove_lock();
- del_lock ($ui->dn);
- session::un_set ('macroManagment');
+ $macroManagement = session::get('macroManagement');
+ $macroManagement->remove_lock();
+ session::un_set ('macroManagement');
}
} else {
- /* Create macroManagment object on demand */
- if (!session::is_set('macroManagment') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
- session::set('macroManagment',new goFonMacro ($config, $ui));
+ /* Create macroManagement object on demand */
+ if (!session::is_set('macroManagement') || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+ session::set('macroManagement',new goFonMacro ($config, $ui));
}
/* Get object */
- $macroManagment = session::get('macroManagment');
- $macroManagment->save_object();
- $output= $macroManagment->execute();
+ $macroManagement = session::get('macroManagement');
+ $macroManagement->save_object();
+ $output= $macroManagement->execute();
/* Page header*/
if (session::is_set('objectinfo')){
/* Reset requested? */
if (isset($_GET['reset']) && $_GET['reset'] == 1){
del_lock ($ui->dn);
- session::un_set ('macroManagment');
+ session::un_set ('macroManagement');
}
/* Show and save dialog */
$display.= $output;
- session::set('macroManagment',$macroManagment);
+ session::set('macroManagement',$macroManagement);
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>