Code

Added snapshot & C&P acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 8 Nov 2006 09:17:46 +0000 (09:17 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 8 Nov 2006 09:17:46 +0000 (09:17 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5041 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_divListGroup.inc
plugins/admin/groups/class_groupManagement.inc
plugins/admin/users/class_userManagement.inc

index b46e8ee0826dbf74225b9bd84e0dde0ea7b50b01..63062265b9a8bb69ae2d1fa3ee15edfab1355761 100644 (file)
@@ -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.= "<input class='center' type='image'
           src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
         $actions.= "<input class='center' type='image'
           src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
       }
 
+      /* Add edit icon */
       $actions.= "<input class='center' type='image'
         src='images/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
 
-      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.= "<input class='center' type='image'
           src='images/edittrash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
       }
index 80b567a04e93aff62f55da60e60e9f9aaf82f7a3..7158c1090fa0f3831170097f221858dedcda69f6 100644 (file)
@@ -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.");
+      }
     }
   }
 
index 5cf79f71e1bf2e400892b2721fe38a8510ef08da..daa147d92741f7c44fdfe6d3a5892a645123d653 100644 (file)
@@ -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.");
+        }
       }
     }
   }