# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- HEAD
+++ Modified In Working Tree
@@ -356,6 +356,7 @@
    *  We should be free of the batch at this point
    */
   function execute_final() {
+    if ($this->user_file_access() === true) {
     // Should we download the file.
     if (!empty($_GET['download'])) {
       // This next method will exit.
@@ -367,8 +368,28 @@
       return $this->render_complete();
     }
   }
+    else {
+      drupal_access_denied();
+    }
+  }
 
-
+/*
+ * File access rule based on file author
+ */
+  function user_file_access() {
+    if (empty($this->_output_file) && !empty($this->batched_execution_state->fid)) {
+// Return the filename associated with this file.
+      $this->_output_file = $this->file_load($this->batched_execution_state->fid);
+    }
+    $file_author = $this->_output_file->uid; 
+    global $user;
+    if ($file_author == $user->uid || user_access('access all views_data_export')) {
+      return true;
+    }
+    else {
+      return false;
+    }
+  }
   /**
    * Render the display.
    *