diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php index 4fabcc4db1..cce26a8de6 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php @@ -9,7 +9,6 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; -use Utopia\Database\Query; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -61,10 +60,11 @@ class Delete extends Action throw new Exception(Exception::PROJECT_NOT_FOUND); } - $key = $dbForPlatform->findOne('devKeys', [ - Query::equal('$id', [$keyId]), - Query::equal('projectInternalId', [$project->getInternalId()]), - ]); + $key = $dbForPlatform->getDocument('devKeys', $keyId); + + if ($key === false || $key->isEmpty() || $key->getAttribute('projectInternalId') !== $project->getInternalId()) { + throw new Exception(Exception::KEY_NOT_FOUND); + } if ($key === false || $key->isEmpty()) { throw new Exception(Exception::KEY_NOT_FOUND); diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php index bfbfd6e76c..ebc0c1bcbb 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php @@ -9,7 +9,6 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; -use Utopia\Database\Query; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; use Utopia\Platform\Scope\HTTP; @@ -61,10 +60,11 @@ class Get extends Action throw new Exception(Exception::PROJECT_NOT_FOUND); } - $key = $dbForPlatform->findOne('devKeys', [ - Query::equal('$id', [$keyId]), - Query::equal('projectInternalId', [$project->getInternalId()]), - ]); + $key = $dbForPlatform->getDocument('devKeys', $keyId); + + if ($key === false || $key->isEmpty() || $key->getAttribute('projectInternalId') !== $project->getInternalId()) { + throw new Exception(Exception::KEY_NOT_FOUND); + } if ($key === false || $key->isEmpty()) { throw new Exception(Exception::KEY_NOT_FOUND); diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php index 7513805913..c8560098cd 100644 --- a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php @@ -9,7 +9,6 @@ use Appwrite\SDK\Method; use Appwrite\SDK\Response as SDKResponse; use Appwrite\Utopia\Response; use Utopia\Database\Database; -use Utopia\Database\Query; use Utopia\Database\Validator\Datetime as DatetimeValidator; use Utopia\Database\Validator\UID; use Utopia\Platform\Action; @@ -63,12 +62,9 @@ class Update extends Action throw new Exception(Exception::PROJECT_NOT_FOUND); } - $key = $dbForPlatform->findOne('devKeys', [ - Query::equal('$id', [$keyId]), - Query::equal('projectInternalId', [$project->getInternalId()]), - ]); + $key = $dbForPlatform->getDocument('devKeys', $keyId); - if ($key === false || $key->isEmpty()) { + if ($key === false || $key->isEmpty() || $key->getAttribute('projectInternalId') !== $project->getInternalId()) { throw new Exception(Exception::KEY_NOT_FOUND); }