From daee49636bae1c10c79fe95278b4a391a3fc040f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Carretero?=
 <frederic.carretero@veremes.com>
Date: Mon, 26 Nov 2018 16:04:08 +0100
Subject: [PATCH] =?UTF-8?q?Acc=C3=A8s=20public=20en=20lecture=20pour=20les?=
 =?UTF-8?q?=20fichiers=20envoy=C3=A9s=20sur=20S3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 vas/rest/class/vmlib/phpUtil.inc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/vas/rest/class/vmlib/phpUtil.inc b/vas/rest/class/vmlib/phpUtil.inc
index fc0694c8..7c1db325 100755
--- a/vas/rest/class/vmlib/phpUtil.inc
+++ b/vas/rest/class/vmlib/phpUtil.inc
@@ -159,7 +159,8 @@ function stripslashes_deep($aString) {
                  $aResult = $s3->putObject(array(
                    'Bucket' => $sBucket,
                    'Key'    => $sServerPath,
-                   'Body'   => file_get_contents($sTmpFile)
+                   'Body'   => file_get_contents($sTmpFile),
+                   'GrantRead' => 'uri=http://acs.amazonaws.com/groups/global/AllUsers'
                  ));
 
                } else if (!copy($sTmpFile, $sServerPath)) {
@@ -513,7 +514,8 @@ function stripslashes_deep($aString) {
        $aResult = $s3->putObject(array(
          'Bucket' => $sBucket,
          'Key' => $sPrefix . str_replace($properties['ws_data_dir'], "/ws_data", $sFilePath) . $aFileStruct["name"],
-         'Body' => file_get_contents($aFileStruct["tmp_name"])
+         'Body' => file_get_contents($aFileStruct["tmp_name"]),
+         'GrantRead' => 'uri=http://acs.amazonaws.com/groups/global/AllUsers'
        ));
 
        unlink($aFileStruct["tmp_name"]);
@@ -1635,7 +1637,7 @@ function putFileContentInWsDataDir($sModule, $sObject, $mId = '', $sField = '',
                 'Bucket' => $sBucket,
                 'Key' => $sServerPath,
                 'Body' => $sFileContent,
-                'ACL' => 'public-read'
+                'GrantRead' => 'uri=http://acs.amazonaws.com/groups/global/AllUsers'
             ));
         }
         catch(Aws\S3\Exception\S3Exception $e) {
-- 
GitLab