From afd2c7a065d266db90088565044924362eccc78d Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 3 May 2023 12:03:23 -0700 Subject: [PATCH 1/4] Update migration to set bucket permissions in metadata table --- src/Appwrite/Migration/Version/V18.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Appwrite/Migration/Version/V18.php b/src/Appwrite/Migration/Version/V18.php index e55d62b0c5..be628e0fbb 100644 --- a/src/Appwrite/Migration/Version/V18.php +++ b/src/Appwrite/Migration/Version/V18.php @@ -182,6 +182,19 @@ class V18 extends Migration */ $document->setAttribute('options', $document->getAttribute('options', new \stdClass())); break; + case 'buckets': + /** + * Set the bucket permission in the metadata table + */ + try { + $internalBucketId = "bucket_{$this->project->getInternalId()}"; + $permissions = $document->getPermissions(); + $fileSecurity = $document->getAttribute('fileSecurity', false); + $this->projectDB->updateCollection($internalBucketId, $permissions, $fileSecurity); + } catch (\Throwable $th) { + Console::warning($th->getMessage()); + } + break; } return $document; From 4dd6a7977ef5a741d65141a6da89b916b2fc4d22 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 3 May 2023 12:06:36 -0700 Subject: [PATCH 2/4] Update create and update bucket APIs Ensure the permissions and document security are updated in the metadata collection. --- app/controllers/api/storage.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index b936fc6b2f..ed36880454 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -128,7 +128,7 @@ App::post('/v1/storage/buckets') $bucket = $dbForProject->getDocument('buckets', $bucketId); - $dbForProject->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes); + $dbForProject->createCollection('bucket_' . $bucket->getInternalId(), $attributes, $indexes, permissions: $permissions ?? [], documentSecurity: $fileSecurity); } catch (Duplicate) { throw new Exception(Exception::STORAGE_BUCKET_ALREADY_EXISTS); } @@ -274,6 +274,7 @@ App::put('/v1/storage/buckets/:bucketId') ->setAttribute('encryption', $encryption) ->setAttribute('compression', $compression) ->setAttribute('antivirus', $antivirus)); + $dbForProject->updateCollection('bucket_' . $bucket->getInternalId(), $permissions, $fileSecurity); $events ->setParam('bucketId', $bucket->getId()) From c46a02b49629f6286a5a4cb84130e1038f18ecf2 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 3 May 2023 12:13:58 -0700 Subject: [PATCH 3/4] Update CHANGES.md --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 84137981c9..b77ca2e3ce 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +# Version 1.3.4 + +## Bugs + +- Update migration to properly migrate bucket permissiosn [#5497](https://github.com/appwrite/appwrite/pull/5497) + # Version 1.3.3 ## Bugs From d7bbfb55eda3211d707053a58d6570b3797b6275 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 3 May 2023 13:39:05 -0700 Subject: [PATCH 4/4] Prepare 1.3.4 release --- README-CN.md | 6 +++--- README.md | 6 +++--- app/init.php | 2 +- src/Appwrite/Migration/Migration.php | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README-CN.md b/README-CN.md index 9a6262e8d9..e8e6a8c8f2 100644 --- a/README-CN.md +++ b/README-CN.md @@ -67,7 +67,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` ### Windows @@ -79,7 +79,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` #### PowerShell @@ -89,7 +89,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 5c98ed6c6f..5ea99747a4 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` ### Windows @@ -89,7 +89,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` #### PowerShell @@ -99,7 +99,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.3.3 + appwrite/appwrite:1.3.4 ``` Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation. diff --git a/app/init.php b/app/init.php index b5def038c1..2dd01d2134 100644 --- a/app/init.php +++ b/app/init.php @@ -101,7 +101,7 @@ const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 503; -const APP_VERSION_STABLE = '1.3.3'; +const APP_VERSION_STABLE = '1.3.4'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 9ce1d262fc..397d41efdd 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -59,6 +59,7 @@ abstract class Migration '1.3.1' => 'V18', '1.3.2' => 'V18', '1.3.3' => 'V18', + '1.3.4' => 'V18', ]; /**