diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc
index bd0ebb2e29abb73f5fd37e6b293ad5c6c9aba122..b2a9cd44340de905b79c5de595ce65ce067154b6 100644 (file)
var $app_base ="";
var $app_release ="";
+ var $dns = array();
+
function IsReleaseManagementActivated()
{
/* Check if we should enable the release selection */
/* These vars will be stored if you try to open a locked app,
to be able to perform your last requests after showing a warning message */
- session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/"));
+ session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/","/^menu_action/"));
$smarty = get_smarty(); // Smarty instance
$s_action = ""; // Contains the action to proceed
/* Cancel dialogs */
if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
- del_lock ($this->apptabs->dn);
- unset ($this->apptabs);
+ $this->remove_lock();
$this->apptabs= NULL;
session::un_set('objectinfo');
}
/* Application has been saved successfully, remove lock from
LDAP. */
if ($this->dn != "new"){
- del_lock ($this->dn);
+ $this->remove_lock();
}
- unset ($this->apptabs);
$this->apptabs= NULL;
session::un_set('objectinfo');
+ }else{
+
+ /* Reinitialize tab */
+ if($this->apptabs instanceof tabs){
+ $this->apptabs->re_init();
+ }
}
} else {
/* Ok. There seem to be errors regarding to the tab data,
$ids = $this->list_get_selected_items();
if(count($ids)){
+ $this->dns = array();
+ $disallowed = array();
foreach($ids as $id){
$dn = $this->applications[$id]['dn'];
- $this->dns[$id] = $dn;
- }
- if ($user= get_multiple_locks($this->dns)){
- return(gen_locked_message($user,$this->dns));
+ $acl = $this->ui->get_permissions($dn, "application/application");
+ if(preg_match("/d/",$acl)){
+ $this->dns[$id] = $dn;
+ }else{
+ $disallowed[] = $dn;
+ }
}
- $dns_names = array();
- foreach($this->dns as $dn){
- add_lock ($dn, $this->ui->dn);
- $dns_names[] =@LDAP::fix($dn);
+ if(count($disallowed)){
+ msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
}
- /* Lock the current entry, so nobody will edit it during deletion */
- $smarty->assign("intro", msgPool::deleteInfo($dns_names,_("application")));
- $smarty->assign("multiple", true);
- return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ if(count($this->dns)){
+
+ 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);
+ }
+
+ /* Lock the current entry, so nobody will edit it during deletion */
+ $smarty->assign("intro", msgPool::deleteInfo($dns_names,_("application")));
+ $smarty->assign("multiple", true);
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
}
}
msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
}
- /* 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_application_cancel'])){
- foreach($this->dns as $key => $dn){
- del_lock ($dn);
- unset($this->dns[$key]);
- }
+
+ /* Remove lock file after successfull deletion */
+ $this->remove_lock();
+ $this->dns = array();
}
/****************
}
/* Remove lock file after successfull deletion */
- del_lock ($this->dn);
+ $this->remove_lock();
}
/* Delete application canceled? */
if (isset($_POST['delete_cancel'])){
- del_lock ($this->dn);
+ $this->remove_lock();
session::un_set('objectinfo');
}
return("");
}
+ $ui = get_userinfo();
+
/* Add a single entry to queue */
if($s_action == "cut" || $s_action == "copy"){
/* Cleanup object queue */
$this->CopyPasteHandler->cleanup_queue();
$dn = $this->applications[$s_entry]['dn'];
- $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+ if($s_action == "copy" && preg_match("/r/",$ui->has_complete_category_acls($dn,"application"))){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+ }
+ if($s_action == "cut" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"application"))){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+ }
}
foreach($this->list_get_selected_items() as $id){
$dn = $this->applications[$id]['dn'];
- if($s_action == "copy_multiple"){
+ if($s_action == "copy_multiple" && preg_match("/r/",$ui->has_complete_category_acls($dn,"application"))){
$this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
}
- if($s_action == "cut_multiple"){
+ if($s_action == "cut_multiple" && preg_match("/(r.*d|d.*r)/",$ui->has_complete_category_acls($dn,"application"))){
$this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
}
}
/* Get dialog */
$this->CopyPasteHandler->SetVar("base",$this->app_base);
- $this->CopyPasteHandler->SetVar("parent",&$this);
+ $this->CopyPasteHandler->SetVar("parent",$this);
$data = $this->CopyPasteHandler->execute();
/* Return dialog data */
$this->postcreate();
}
+
function remove_lock()
{
if (isset($this->apptabs->dn)){
del_lock ($this->apptabs->dn);
}
+ if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
+ del_lock($this->dn);
+ }
+ if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
+ del_lock($this->dns);
+ }
}
+
function save_object()
{
$this->DivListApplication->save_object();