Code

Added permission check
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Jan 2010 08:34:47 +0000 (08:34 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Jan 2010 08:34:47 +0000 (08:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15094 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiManagement.inc

index 8fd3847eb0a6b8efb5a0791972cc0b9a109e62c7..141cff98b6d0da83eaa94a70c822d9138666c576 100644 (file)
@@ -351,9 +351,14 @@ class faiManagement extends management
   function removeFAIObjects($to_delete)
   {
     // Do not allow to remove objects with state freeezed
-    $errors=array();
+    $errors = $disallowed = array();
+  
     foreach($to_delete as $obj){
-      if(isset($obj['FAIstate']) && preg_match('/^freeze/', $obj['FAIstate'])){
+      $type = $this->get_type($obj);
+      $acl  = $this->ui->get_permissions($obj['dn'],"fai/".$type[1]);
+      if(!preg_match("/d/",$acl)){
+        $disallowed[] = $obj['dn'];
+      }elseif(isset($obj['FAIstate']) && preg_match('/^freeze/', $obj['FAIstate'])){
         $errors[] = $obj['dn'];
       }else{
         $this->dns[] = $obj['dn'];
@@ -363,6 +368,9 @@ class faiManagement extends management
       msg_dialog::display(_("Branch locked"),
           sprintf(_("The following entries are locked, you can't remove them %s."),msgPool::buildList($errors)),INFO_DIALOG);
     }
+    if(count($disallowed)){ 
+      msg_dialog::display(_("Permission error"), msgPool::permDelete($disallowed), ERROR_DIALOG);
+    }
 
     // Check entry locking
     if(count($this->dns)){