From: hickert Date: Wed, 8 Nov 2006 09:17:46 +0000 (+0000) Subject: Added snapshot & C&P acls X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e825ddf5b368cf24e6f7f508e823e6837b98ae5b;p=gosa.git Added snapshot & C&P acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5041 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/groups/class_divListGroup.inc b/plugins/admin/groups/class_divListGroup.inc index b46e8ee08..63062265b 100644 --- a/plugins/admin/groups/class_divListGroup.inc +++ b/plugins/admin/groups/class_divListGroup.inc @@ -108,7 +108,7 @@ class divListGroup extends MultiSelectWindow $acls = $ui->get_permissions($this->selectedBase,"groups/group"); /* Get copy & paste icon */ - if(preg_match("/w/",$acls) && $this->parent->CopyPasteHandler){ + if(preg_match("/(c.*w|w.*c)/",$acls) && $this->parent->CopyPasteHandler){ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); }else{ $Copy_Paste =""; @@ -191,22 +191,26 @@ class divListGroup extends MultiSelectWindow foreach($groups as $key => $val){ /* Create action icons - copy & paste icons */ + $acl = $ui->get_permissions($val['dn'],"groups/group"); + $actions= ""; - if(($this->parent->CopyPasteHandler) && preg_match("/w/",$ui->get_category_permissions($val['dn'],"group"))){ + if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl)){ $actions.= " "; $actions.= " "; } + /* Add edit icon */ $actions.= ""; - if(preg_match("/w/",$ui->get_permissions($val['dn'],"groups/group"))){ + /* Add snapshot functionality */ + if(preg_match("/(c.*w|w.*c)/", $acl)){ $actions.= $this->GetSnapShotActions($val['dn']); } - if(preg_match("/d/",$ui->get_permissions($val['dn'],"groups/group"))){ + if(preg_match("/d/",$acl)){ $actions.= ""; } diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 80b567a04..7158c1090 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -506,31 +506,41 @@ class groupManagement extends plugin /* Copy current object to CopyHandler */ if($s_action == "copy"){ - $this->CopyPasteHandler->Clear(); $dn = $this->grouplist[trim($s_entry)]['dn']; - $acl = get_permissions ($dn, $this->ui->subtreeACL); - - $obj = new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn); - $obj->set_acl_base($dn); - $objNew = new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], "new"); - $obj->set_acl_base($dn); - - $this->CopyPasteHandler->Copy($obj,$objNew); + $acl = $this->ui->get_permissions($dn,"groups/group"); + if(preg_match("/(c.*w|w.*c)/",$acl)){ + + $this->CopyPasteHandler->Clear(); + $obj = new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn); + $obj->set_acl_base($dn); + $objNew = new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], "new"); + $obj->set_acl_base($dn); + + $this->CopyPasteHandler->Copy($obj,$objNew); + }else{ + print_red("You are not allowed to copy this entry."); + } } /* Copy current object to CopyHandler */ if($s_action == "cut"){ - $this->CopyPasteHandler->Clear(); - $dn = $this->grouplist[trim($s_entry)]['dn']; - $acl= get_permissions ($dn, $this->ui->subtreeACL); + $acl = $this->ui->get_permissions($dn,"groups/group"); + if(preg_match("/(c.*w|w.*c)/",$acl)){ - $obj= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn); - $obj->set_acl_base($dn); + $this->CopyPasteHandler->Clear(); + $dn = $this->grouplist[trim($s_entry)]['dn']; + $acl= get_permissions ($dn, $this->ui->subtreeACL); - $this->CopyPasteHandler->Cut($obj); + $obj= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn); + $obj->set_acl_base($dn); + + $this->CopyPasteHandler->Cut($obj); + }else{ + print_red("You are not allowed to cut this entry."); + } } } diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index 5cf79f71e..daa147d92 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -817,12 +817,19 @@ class userManagement extends plugin if($s_action == "copy"){ $this->CopyPasteHandler->Clear(); $dn= $this->list[trim($s_entry)]['dn']; - $obj = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn); - $obj->set_acl_base($dn); - $objNew = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], "new"); - $objNew->set_acl_base($dn); - $this->CopyPasteHandler->Copy($obj,$objNew); + /* Check acl */ + $acl = $this->ui->get_permissions($dn,"users/user"); + if(preg_match("/(c.*w|w.*c)/",$acl)){ + $obj = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn); + $obj->set_acl_base($dn); + $objNew = new usertabs($this->config, $this->config->data['TABS']['USERTABS'], "new"); + $objNew->set_acl_base($dn); + + $this->CopyPasteHandler->Copy($obj,$objNew); + }else{ + print_red("You are not allowed to copy this entry."); + } } /* Cut selected object. @@ -830,9 +837,16 @@ class userManagement extends plugin if($s_action == "cut"){ $this->CopyPasteHandler->Clear(); $dn= $this->list[trim($s_entry)]['dn']; - $obj= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn); - $obj->set_acl_base($dn); - $this->CopyPasteHandler->Cut($obj); + + /* Check acl */ + $acl = $this->ui->get_permissions($dn,"users/user"); + if(preg_match("/(c.*w|w.*c)/",$acl)){ + $obj= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn); + $obj->set_acl_base($dn); + $this->CopyPasteHandler->Cut($obj); + }else{ + print_red("You are not allowed to cut this entry."); + } } } }