Merge branch 'main' into feat-function-execution-filters
This commit is contained in:
commit
c105cfda1a
5 changed files with 36 additions and 3 deletions
|
@ -408,7 +408,7 @@ return [
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => '_APP_SMTP_SECURE',
|
'name' => '_APP_SMTP_SECURE',
|
||||||
'description' => 'SMTP secure connection protocol. Empty by default, change to \'tls\' if running on a secure connection.',
|
'description' => 'SMTP secure connection protocol. Empty by default, change to \'tls\' or \'ssl\' if running on a secure connection.',
|
||||||
'introduction' => '',
|
'introduction' => '',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
|
|
|
@ -2526,7 +2526,7 @@ App::post('/v1/account/recovery')
|
||||||
|
|
||||||
$queueForMails
|
$queueForMails
|
||||||
->setRecipient($profile->getAttribute('email', ''))
|
->setRecipient($profile->getAttribute('email', ''))
|
||||||
->setName($profile->getAttribute('name'))
|
->setName($profile->getAttribute('name', ''))
|
||||||
->setBody($body)
|
->setBody($body)
|
||||||
->setVariables($emailVariables)
|
->setVariables($emailVariables)
|
||||||
->setSubject($subject)
|
->setSubject($subject)
|
||||||
|
|
|
@ -2997,6 +2997,33 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
|
||||||
$processDocument($collection, $document);
|
$processDocument($collection, $document);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$select = \array_reduce($queries, function ($result, $query) {
|
||||||
|
return $result || ($query->getMethod() === Query::TYPE_SELECT);
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
// Check if the SELECT query includes $databaseId and $collectionId
|
||||||
|
$hasDatabaseId = false;
|
||||||
|
$hasCollectionId = false;
|
||||||
|
if ($select) {
|
||||||
|
$hasDatabaseId = \array_reduce($queries, function ($result, $query) {
|
||||||
|
return $result || ($query->getMethod() === Query::TYPE_SELECT && \in_array('$databaseId', $query->getValues()));
|
||||||
|
}, false);
|
||||||
|
$hasCollectionId = \array_reduce($queries, function ($result, $query) {
|
||||||
|
return $result || ($query->getMethod() === Query::TYPE_SELECT && \in_array('$collectionId', $query->getValues()));
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($select) {
|
||||||
|
foreach ($documents as $document) {
|
||||||
|
if (!$hasDatabaseId) {
|
||||||
|
$document->removeAttribute('$databaseId');
|
||||||
|
}
|
||||||
|
if (!$hasCollectionId) {
|
||||||
|
$document->removeAttribute('$collectionId');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$response->dynamic(new Document([
|
$response->dynamic(new Document([
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'documents' => $documents,
|
'documents' => $documents,
|
||||||
|
|
|
@ -1446,7 +1446,7 @@ App::patch('/v1/projects/:projectId/smtp')
|
||||||
->param('port', 587, new Integer(), 'SMTP server port', true)
|
->param('port', 587, new Integer(), 'SMTP server port', true)
|
||||||
->param('username', '', new Text(0, 0), 'SMTP server username', true)
|
->param('username', '', new Text(0, 0), 'SMTP server username', true)
|
||||||
->param('password', '', new Text(0, 0), 'SMTP server password', true)
|
->param('password', '', new Text(0, 0), 'SMTP server password', true)
|
||||||
->param('secure', '', new WhiteList(['tls'], true), 'Does SMTP server use secure connection', true)
|
->param('secure', '', new WhiteList(['tls', 'ssl'], true), 'Does SMTP server use secure connection', true)
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('dbForConsole')
|
->inject('dbForConsole')
|
||||||
->action(function (string $projectId, bool $enabled, string $senderName, string $senderEmail, string $replyTo, string $host, int $port, string $username, string $password, string $secure, Response $response, Database $dbForConsole) {
|
->action(function (string $projectId, bool $enabled, string $senderName, string $senderEmail, string $replyTo, string $host, int $port, string $username, string $password, string $secure, Response $response, Database $dbForConsole) {
|
||||||
|
|
|
@ -4068,6 +4068,8 @@ trait DatabasesBase
|
||||||
$this->assertEquals(2, count($response['body']['documents']));
|
$this->assertEquals(2, count($response['body']['documents']));
|
||||||
$this->assertEquals(null, $response['body']['documents'][0]['fullName']);
|
$this->assertEquals(null, $response['body']['documents'][0]['fullName']);
|
||||||
$this->assertArrayNotHasKey("libraries", $response['body']['documents'][0]);
|
$this->assertArrayNotHasKey("libraries", $response['body']['documents'][0]);
|
||||||
|
$this->assertArrayNotHasKey('$databaseId', $response['body']['documents'][0]);
|
||||||
|
$this->assertArrayNotHasKey('$collectionId', $response['body']['documents'][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4087,6 +4089,8 @@ trait DatabasesBase
|
||||||
|
|
||||||
$this->assertEquals(200, $response['headers']['status-code']);
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
$this->assertArrayNotHasKey('libraries', $response['body']['documents'][0]);
|
$this->assertArrayNotHasKey('libraries', $response['body']['documents'][0]);
|
||||||
|
$this->assertArrayNotHasKey('$databaseId', $response['body']['documents'][0]);
|
||||||
|
$this->assertArrayNotHasKey('$collectionId', $response['body']['documents'][0]);
|
||||||
|
|
||||||
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/collections/' . $data['personCollection'] . '/documents', array_merge([
|
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/collections/' . $data['personCollection'] . '/documents', array_merge([
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
|
@ -4099,6 +4103,8 @@ trait DatabasesBase
|
||||||
$document = $response['body']['documents'][0];
|
$document = $response['body']['documents'][0];
|
||||||
$this->assertEquals(200, $response['headers']['status-code']);
|
$this->assertEquals(200, $response['headers']['status-code']);
|
||||||
$this->assertArrayHasKey('libraries', $document);
|
$this->assertArrayHasKey('libraries', $document);
|
||||||
|
$this->assertArrayNotHasKey('$databaseId', $document);
|
||||||
|
$this->assertArrayNotHasKey('$collectionId', $document);
|
||||||
|
|
||||||
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/collections/' . $data['personCollection'] . '/documents/' . $document['$id'], array_merge([
|
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/collections/' . $data['personCollection'] . '/documents/' . $document['$id'], array_merge([
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
|
|
Loading…
Reference in a new issue