diff --git a/gosa-plugins/goto/admin/devices/class_deviceManagement.inc b/gosa-plugins/goto/admin/devices/class_deviceManagement.inc
index 2acbc874ca2fe6fc816d00695af0e3a23c92784c..7b3f750f66d8280fd19d17f332e75cfd202efd1d 100644 (file)
var $dn ="";
var $dns = array();
+ var $acl_module = array("devices");
+
function deviceManagement(&$config, $dn= NULL)
{
plugin::plugin ($config, $dn);
if(count($ids)){
- /* collect entries */
+ $disallowed = array();
foreach($ids as $id){
- $this->dns[$id] = $this->devices[$id]['dn'];
+ $dn = $this->devices[$id]['dn'];
+ $acl = $this->ui->get_permissions($dn, "devices/deviceGeneric");
+ if(preg_match("/d/",$acl)){
+ $this->dns[$id] = $dn;
+ }else{
+ $disallowed[] = $dn;
+ }
}
- /* Check locks */
- if ($user= get_multiple_locks($this->dns)){
- return(gen_locked_message($user,$this->dns));
+ if(count($disallowed)){
+ msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
}
- $dns_names = array();
- foreach($this->dns as $dn){
- $dns_names[] =@LDAP::fix($dn);
- }
- add_lock ($this->dns, $this->ui->dn);
+ if(count($this->dns)){
- /* Lock the current entry, so nobody will edit it during deletion */
- $smarty->assign("intro", msgPool::deleteInfo($dns_names),_("device"));
- $smarty->assign("multiple", true);
- return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ /* Check locks */
+ if ($user= get_multiple_locks($this->dns)){
+ return(gen_locked_message($user,$this->dns));
+ }
+
+ $dns_names = array();
+ foreach($this->dns as $dn){
+ $dns_names[] =@LDAP::fix($dn);
+ }
+ 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),_("device"));
+ $smarty->assign("multiple", true);
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
}
}
/* Check if there is a snapshot dialog open */
$base = $this->DivListDevices->selectedBase;
- if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+ if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases(),$this)){
return($str);
}
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->devices[$s_entry]['dn'];
- $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
+ if($s_action == "copy" && $ui->is_copyable($dn,"devices","deviceGeneric")){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
+ }
+ if($s_action == "cut" && $ui->is_cutable($dn,"devices","deviceGeneric")){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"devicetabs","DEVICETABS","devices");
+ }
}
/* Add entries to queue */
foreach($this->list_get_selected_items() as $id){
$dn = $this->devices[$id]['dn'];
- if($s_action == "copy_multiple"){
+ if($s_action == "copy_multiple" && $ui->is_copyable($dn,"devices","deviceGeneric")){
$this->CopyPasteHandler->add_to_queue($dn,"copy","devicetabs","DEVICETABS","devices");
}
- if($s_action == "cut_multiple"){
+ if($s_action == "cut_multiple" && $ui->is_cutable($dn,"devices","deviceGeneric")){
$this->CopyPasteHandler->add_to_queue($dn,"cut","devicetabs","DEVICETABS","devices");
}
}
if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
/* Get dialog */
- $data = $this->CopyPasteHandler->execute();
$this->CopyPasteHandler->SetVar("base",$this->DivListDevices->selectedBase);
+ $data = $this->CopyPasteHandler->execute();
/* Return dialog data */
if(!empty($data)){