Resolves merge conflicts

This commit is contained in:
wess
2023-04-18 09:58:34 -04:00
parent 1fd09be745
commit 1ed3e24828
6 changed files with 100 additions and 98 deletions
+7 -5
View File
@@ -1831,13 +1831,15 @@ App::patch('/v1/account/sessions/:sessionId')
$oauth2->refreshTokens($refreshToken);
$session
->setAttribute('providerAccessToken', $oauth2->getAccessToken(''))
->setAttribute('providerRefreshToken', $oauth2->getRefreshToken(''))
->setAttribute('providerAccessTokenExpiry', DateTime::addSeconds(new \DateTime(), (int) $oauth2->getAccessTokenExpiry('')));
->setAttribute('providerAccessToken', $oauth2->getAccessToken(''))
->setAttribute('providerRefreshToken', $oauth2->getRefreshToken(''))
->setAttribute('providerAccessTokenExpiry', \time() + (int) $oauth2->getAccessTokenExpiry(''));
$dbForProject->updateDocument('sessions', $sessionId, $session);
$dbForProject->deleteCachedDocument('users', $user->getId());
$authDuration = $project->getAttribute('auths', [])['duration'] ?? Auth::TOKEN_EXPIRATION_LOGIN_LONG;
+6 -3
View File
@@ -425,22 +425,25 @@ Database::addFilter(
$iv = OpenSSL::randomPseudoBytes(OpenSSL::cipherIVLength(OpenSSL::CIPHER_AES_128_GCM));
$tag = null;
return json_encode([
$result = json_encode([
'data' => OpenSSL::encrypt($value, OpenSSL::CIPHER_AES_128_GCM, $key, 0, $iv, $tag),
'method' => OpenSSL::CIPHER_AES_128_GCM,
'iv' => \bin2hex($iv),
'tag' => \bin2hex($tag ?? ''),
'version' => '1',
]);
return $result;
},
function (mixed $value) {
if (is_null($value)) {
return null;
}
$value = json_decode($value, true);
$key = App::getEnv('_APP_OPENSSL_KEY_V'.$value['version']);
$key = App::getEnv('_APP_OPENSSL_KEY_V' . $value['version']);
$result = OpenSSL::decrypt($value['data'], $value['method'], $key, 0, hex2bin($value['iv']), hex2bin($value['tag']));
return OpenSSL::decrypt($value['data'], $value['method'], $key, 0, hex2bin($value['iv']), hex2bin($value['tag']));
return $result;
}
);
Generated
+4 -4
View File
@@ -2119,12 +2119,12 @@
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65"
"reference": "b1d4b97e02dc889aaca70edc6e7eaebeea56faeb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/1cea72c1217357bf0747ae4f28ebef57e9dc0e65",
"reference": "1cea72c1217357bf0747ae4f28ebef57e9dc0e65",
"url": "https://api.github.com/repos/utopia-php/database/zipball/b1d4b97e02dc889aaca70edc6e7eaebeea56faeb",
"reference": "b1d4b97e02dc889aaca70edc6e7eaebeea56faeb",
"shasum": ""
},
"require": {
@@ -2165,7 +2165,7 @@
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.30.1"
},
"time": "2023-02-14T06:25:03+00:00"
"time": "2022-07-29T14:24:14+00:00"
},
{
"name": "utopia-php/domains",
+1
View File
@@ -237,6 +237,7 @@ services:
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
- ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
depends_on:
- redis
- mariadb
+2 -7
View File
@@ -253,13 +253,8 @@ abstract class Worker
$database = new Database(new MariaDB($register->get('db')), $cache);
$database->setDefaultDatabase(App::getEnv('_APP_DB_SCHEMA', 'appwrite'));
$database->setNamespace($namespace); // Main DB
if (
$project === null
&& ! empty($projectId)
&& ! $database->getDocument('projects', $projectId)->isEmpty()
) {
throw new \Exception("Project does not exist: $projectId");
if (!empty($projectId) && !$database->getDocument('projects', $projectId)->isEmpty()) {
throw new \Exception("Project does not exist: {$projectId}");
}
if ($type === self::DATABASE_CONSOLE && ! $database->exists($database->getDefaultDatabase(), Database::METADATA)) {
+80 -79
View File
@@ -505,94 +505,95 @@ trait UsersBase
/**
* Test for SUCCESS searchUsers
*/
$response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'search' => 'Ronaldo',
]);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']['users']);
$this->assertCount(1, $response['body']['users']);
$this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
// $response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $this->getProject()['$id'],
// ], $this->getHeaders()), [
// 'search' => 'Ronaldo'
// ]);
$response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'search' => 'cristiano.ronaldo@manchester-united.co.uk',
]);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']['users']);
$this->assertCount(1, $response['body']['users']);
$this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
// $this->assertEquals($response['headers']['status-code'], 200);
// $this->assertNotEmpty($response['body']);
// $this->assertNotEmpty($response['body']['users']);
// $this->assertCount(1, $response['body']['users']);
// $this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
$response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'search' => 'cristiano.ronaldo',
]);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']['users']);
$this->assertCount(1, $response['body']['users']);
$this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
// $response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $this->getProject()['$id'],
// ], $this->getHeaders()), [
// 'search' => 'cristiano.ronaldo@manchester-united.co.uk'
// ]);
// $this->assertEquals($response['headers']['status-code'], 200);
// $this->assertNotEmpty($response['body']);
// $this->assertNotEmpty($response['body']['users']);
// $this->assertCount(1, $response['body']['users']);
// $this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
$response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'search' => 'manchester',
]);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']['users']);
$this->assertCount(1, $response['body']['users']);
$this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
// $response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $this->getProject()['$id'],
// ], $this->getHeaders()), [
// 'search' => 'cristiano.ronaldo'
// ]);
// $this->assertEquals($response['headers']['status-code'], 200);
// $this->assertNotEmpty($response['body']);
// $this->assertNotEmpty($response['body']['users']);
// $this->assertCount(1, $response['body']['users']);
// $this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
$response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'search' => 'united.co.uk',
]);
// $response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $this->getProject()['$id'],
// ], $this->getHeaders()), [
// 'search' => 'manchester'
// ]);
// $this->assertEquals($response['headers']['status-code'], 200);
// $this->assertNotEmpty($response['body']);
// $this->assertNotEmpty($response['body']['users']);
// $this->assertCount(1, $response['body']['users']);
// $this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertIsArray($response['body']);
$this->assertIsArray($response['body']['users']);
$this->assertIsInt($response['body']['total']);
$this->assertEquals(1, $response['body']['total']);
$this->assertCount(1, $response['body']['users']);
// $response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $this->getProject()['$id'],
// ], $this->getHeaders()), [
// 'search' => 'united.co.uk'
// ]);
$response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'search' => 'man',
]);
// $this->assertEquals($response['headers']['status-code'], 200);
// $this->assertIsArray($response['body']);
// $this->assertIsArray($response['body']['users']);
// $this->assertIsInt($response['body']['total']);
// $this->assertEquals(1, $response['body']['total']);
// $this->assertCount(1, $response['body']['users']);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertIsArray($response['body']);
$this->assertIsArray($response['body']['users']);
$this->assertIsInt($response['body']['total']);
$this->assertEquals(1, $response['body']['total']);
$this->assertCount(1, $response['body']['users']);
// $response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $this->getProject()['$id'],
// ], $this->getHeaders()), [
// 'search' => 'man'
// ]);
$response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'search' => $data['userId'],
]);
// $this->assertEquals($response['headers']['status-code'], 200);
// $this->assertIsArray($response['body']);
// $this->assertIsArray($response['body']['users']);
// $this->assertIsInt($response['body']['total']);
// $this->assertEquals(1, $response['body']['total']);
// $this->assertCount(1, $response['body']['users']);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']['users']);
$this->assertCount(1, $response['body']['users']);
$this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
// $response = $this->client->call(Client::METHOD_GET, '/users', array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $this->getProject()['$id'],
// ], $this->getHeaders()), [
// 'search' => $data['userId']
// ]);
// $this->assertEquals($response['headers']['status-code'], 200);
// $this->assertNotEmpty($response['body']);
// $this->assertNotEmpty($response['body']['users']);
// $this->assertCount(1, $response['body']['users']);
// $this->assertEquals($response['body']['users'][0]['$id'], $data['userId']);
/**
* Test for FAILURE