1
0
Fork 0
mirror of synced 2024-05-16 18:52:33 +12:00

Fixed storage tests

This commit is contained in:
Eldad Fux 2024-04-22 21:43:57 +02:00
parent 09e9483d94
commit 99994f6278
3 changed files with 8 additions and 6 deletions

View file

@ -1621,7 +1621,7 @@ Http::delete('/v1/storage/buckets/:bucketId/files/:fileId')
}
// Make sure we don't delete the file before the document permission check occurs
if ($fileSecurity && !$valid && !$authorization->isValid($file->getDelete())) {
if ($fileSecurity && !$valid && !$authorization->isValid(new Input(Database::PERMISSION_DELETE, $file->getDelete()))) {
throw new Exception(Exception::USER_UNAUTHORIZED);
}

8
composer.lock generated
View file

@ -2287,12 +2287,12 @@
"source": {
"type": "git",
"url": "https://github.com/utopia-php/queue.git",
"reference": "309796b08891eac135540c241d8943dd42eccc9e"
"reference": "8749796c05bf9a0abc9c949af5ceb2efa8531960"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/queue/zipball/309796b08891eac135540c241d8943dd42eccc9e",
"reference": "309796b08891eac135540c241d8943dd42eccc9e",
"url": "https://api.github.com/repos/utopia-php/queue/zipball/8749796c05bf9a0abc9c949af5ceb2efa8531960",
"reference": "8749796c05bf9a0abc9c949af5ceb2efa8531960",
"shasum": ""
},
"require": {
@ -2342,7 +2342,7 @@
"issues": "https://github.com/utopia-php/queue/issues",
"source": "https://github.com/utopia-php/queue/tree/feat-coroutine-and-di"
},
"time": "2024-04-21T18:59:04+00:00"
"time": "2024-04-22T18:32:34+00:00"
},
{
"name": "utopia-php/registry",

View file

@ -1089,7 +1089,7 @@ class StorageCustomClientTest extends Scope
$this->assertEquals(200, $file['headers']['status-code']);
// Team 1 view success
// Team 2 view success
$file = $this->client->call(Client::METHOD_GET, '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/view', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@ -1112,6 +1112,8 @@ class StorageCustomClientTest extends Scope
'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'permissions.png'),
]);
$this->assertEquals($file['headers']['status-code'], 401);
// Team 2 create failure
$file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', [
'content-type' => 'multipart/form-data',