diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 7596893af..2fa454c49 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -802,7 +802,9 @@ App::get('/v1/functions/:functionId/executions') /** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Database\Database $projectDB */ - $function = $projectDB->getDocument($functionId, true, true, 'execute'); + Authorization::disable(); + $function = $projectDB->getDocument($functionId); + Authorization::reset(); if (empty($function->getId()) || Database::SYSTEM_COLLECTION_FUNCTIONS != $function->getCollection()) { throw new Exception('Function not found', 404); @@ -844,7 +846,9 @@ App::get('/v1/functions/:functionId/executions/:executionId') /** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Database\Database $projectDB */ - $function = $projectDB->getDocument($functionId, true, true, 'execute'); + Authorization::disable(); + $function = $projectDB->getDocument($functionId); + Authorization::reset(); if (empty($function->getId()) || Database::SYSTEM_COLLECTION_FUNCTIONS != $function->getCollection()) { throw new Exception('Function not found', 404); diff --git a/src/Appwrite/Database/Database.php b/src/Appwrite/Database/Database.php index 4137c6ee2..d0defdec0 100644 --- a/src/Appwrite/Database/Database.php +++ b/src/Appwrite/Database/Database.php @@ -196,18 +196,17 @@ class Database * @param string $id * @param bool $mock is mocked data allowed? * @param bool $decode enable decoding? - * @param string $permission permissions to read * * @return Document */ - public function getDocument($id, bool $mock = true, bool $decode = true, string $permission = 'read') + public function getDocument($id, bool $mock = true, bool $decode = true) { if (\is_null($id)) { return new Document(); } $document = new Document((isset($this->mocks[$id]) && $mock) ? $this->mocks[$id] : $this->adapter->getDocument($id)); - $validator = new Authorization($document, $permission); + $validator = new Authorization($document, 'read'); if (!$validator->isValid($document->getPermissions())) { // Check if user has read access to this document return new Document();