Code

Implemented acl check for copy & paste
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jun 2007 11:03:34 +0000 (11:03 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jun 2007 11:03:34 +0000 (11:03 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6570 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_CopyPasteHandler.inc

index 613f05f17355fda07aee1106296d480cc882d69d..c11849e2fffc857f8a0864a6ef65bb3b1f239f4b 100644 (file)
@@ -228,6 +228,7 @@ class CopyPasteHandler {
      Create unique names, ids, or what ever */
   function execute()
   {
+    $ui = get_userinfo();
     $type = $this->current['method'];
     if($type == "cut"){
       if(isset($_POST['PerformCopyPaste'])){
@@ -236,7 +237,12 @@ class CopyPasteHandler {
           $this->_update_vars();
 
           $msgs = $this->check();
-          if(count ($msgs) ){
+          $acl = $ui->get_category_permissions($this->current['dn'], $this->current['tab_acl_category']);
+          /* Check permissions */ 
+          if(!preg_match("/((c|w)|(w|c))/",$acl)){
+            print_red(sprintf(_("You are not allowed to cut and paste the following object '%s'."),$this->current['dn']));
+          }elseif(count ($msgs) ){
             foreach( $msgs as $msg){
               print_red($msg);
             }
@@ -271,7 +277,13 @@ class CopyPasteHandler {
       if(isset($_POST['PerformCopyPaste'])){
         $this->_update_vars();
         $msgs = $this->check();
-        if(count ($msgs) ){
+
+        $acl = $ui->get_category_permissions($this->current['dn'], $this->current['tab_acl_category']);
+        /* Check permissions */ 
+        if(!preg_match("/((c|w)|(w|c))/",$acl)){
+          print_red(sprintf(_("You are not allowed to copy and paste the following object '%s'."),$this->current['dn']));
+        }elseif(count ($msgs) ){
           foreach( $msgs as $msg){
             print_red($msg);
           }