Merge remote-tracking branch 'origin/1.6.x' into feat-logs-db

This commit is contained in:
Damodar Lohani
2025-02-05 08:17:46 +00:00
5 changed files with 72 additions and 66 deletions
+3 -5
View File
@@ -469,12 +469,12 @@ App::post('/v1/teams/:teamId/memberships')
->inject('queueForStatsUsage')
->inject('plan')
->action(function (string $teamId, string $email, string $userId, string $phone, array $roles, string $url, string $name, Response $response, Document $project, Document $user, Database $dbForProject, Locale $locale, Mail $queueForMails, Messaging $queueForMessaging, Event $queueForEvents, callable $timelimit, StatsUsage $queueForStatsUsage, array $plan) {
$isAPIKey = Auth::isAppUser(Authorization::getRoles());
$isAppUser = Auth::isAppUser(Authorization::getRoles());
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
$url = htmlentities($url);
if (empty($url)) {
if (!$isAPIKey && !$isPrivilegedUser) {
if (!$isAppUser && !$isPrivilegedUser) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'URL is required');
}
}
@@ -482,8 +482,6 @@ App::post('/v1/teams/:teamId/memberships')
if (empty($userId) && empty($email) && empty($phone)) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'At least one of userId, email, or phone is required');
}
$isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles());
$isAppUser = Auth::isAppUser(Authorization::getRoles());
if (!$isPrivilegedUser && !$isAppUser && empty(System::getEnv('_APP_SMTP_HOST'))) {
throw new Exception(Exception::GENERAL_SMTP_DISABLED);
@@ -638,7 +636,7 @@ App::post('/v1/teams/:teamId/memberships')
$dbForProject->purgeCachedDocument('users', $invitee->getId());
} else {
$url = Template::parseURL($url);
$url['query'] = Template::mergeQuery(((isset($url['query'])) ? $url['query'] : ''), ['membershipId' => $membership->getId(), 'userId' => $invitee->getId(), 'secret' => $secret, 'teamId' => $teamId]);
$url['query'] = Template::mergeQuery(((isset($url['query'])) ? $url['query'] : ''), ['membershipId' => $membership->getId(), 'userId' => $invitee->getId(), 'secret' => $secret, 'teamId' => $teamId, 'teamName' => $team->getAttribute('name')]);
$url = Template::unParseURL($url);
if (!empty($email)) {
$projectName = $project->isEmpty() ? 'Console' : $project->getAttribute('name', '[APP-NAME]');
+3 -3
View File
@@ -45,13 +45,13 @@
"ext-sockets": "*",
"appwrite/php-runtimes": "0.16.*",
"appwrite/php-clamav": "2.0.*",
"utopia-php/abuse": "0.47.*",
"utopia-php/abuse": "0.49.*",
"utopia-php/analytics": "0.10.*",
"utopia-php/audit": "0.47.*",
"utopia-php/audit": "0.49.*",
"utopia-php/cache": "0.11.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.56.4",
"utopia-php/database": "0.58.4",
"utopia-php/domains": "0.5.*",
"utopia-php/dsn": "0.2.1",
"utopia-php/framework": "0.33.*",
Generated
+48 -48
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e8d26e7e836db255ba42cf55c3798c97",
"content-hash": "1cbdaa30797ba4f524dbcb830f5e14fa",
"packages": [
{
"name": "adhocore/jwt",
@@ -2453,16 +2453,16 @@
},
{
"name": "symfony/http-client",
"version": "v7.2.2",
"version": "v7.2.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "339ba21476eb184290361542f732ad12c97591ec"
"reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/339ba21476eb184290361542f732ad12c97591ec",
"reference": "339ba21476eb184290361542f732ad12c97591ec",
"url": "https://api.github.com/repos/symfony/http-client/zipball/7ce6078c79a4a7afff931c413d2959d3bffbfb8d",
"reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d",
"shasum": ""
},
"require": {
@@ -2528,7 +2528,7 @@
"http"
],
"support": {
"source": "https://github.com/symfony/http-client/tree/v7.2.2"
"source": "https://github.com/symfony/http-client/tree/v7.2.3"
},
"funding": [
{
@@ -2544,7 +2544,7 @@
"type": "tidelift"
}
],
"time": "2024-12-30T18:35:15+00:00"
"time": "2025-01-28T15:51:35+00:00"
},
{
"name": "symfony/http-client-contracts",
@@ -3136,16 +3136,16 @@
},
{
"name": "utopia-php/abuse",
"version": "0.47.0",
"version": "0.49.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/abuse.git",
"reference": "2b52bb362234d4072b647ed57db1b3be030f57c2"
"reference": "76612c274b895aa3d4d1fa27557a6402463eea99"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/2b52bb362234d4072b647ed57db1b3be030f57c2",
"reference": "2b52bb362234d4072b647ed57db1b3be030f57c2",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/76612c274b895aa3d4d1fa27557a6402463eea99",
"reference": "76612c274b895aa3d4d1fa27557a6402463eea99",
"shasum": ""
},
"require": {
@@ -3153,13 +3153,13 @@
"ext-pdo": "*",
"ext-redis": "*",
"php": ">=8.0",
"utopia-php/database": "0.56.*"
"utopia-php/database": "0.58.*"
},
"require-dev": {
"laravel/pint": "1.5.*",
"phpbench/phpbench": "^1.2",
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^9.4"
"laravel/pint": "1.*",
"phpbench/phpbench": "1.*",
"phpstan/phpstan": "1.*",
"phpunit/phpunit": "9.*"
},
"type": "library",
"autoload": {
@@ -3181,9 +3181,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/abuse/issues",
"source": "https://github.com/utopia-php/abuse/tree/0.47.0"
"source": "https://github.com/utopia-php/abuse/tree/0.49.0"
},
"time": "2025-01-15T02:41:02+00:00"
"time": "2025-02-04T07:33:59+00:00"
},
{
"name": "utopia-php/analytics",
@@ -3233,26 +3233,26 @@
},
{
"name": "utopia-php/audit",
"version": "0.47.0",
"version": "0.49.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/audit.git",
"reference": "1ebd5784ba68645073426f2f04a67726a1bde4d7"
"reference": "9d5c5e0cf0f6d9157b911fc3971da4331d71c96d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/1ebd5784ba68645073426f2f04a67726a1bde4d7",
"reference": "1ebd5784ba68645073426f2f04a67726a1bde4d7",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/9d5c5e0cf0f6d9157b911fc3971da4331d71c96d",
"reference": "9d5c5e0cf0f6d9157b911fc3971da4331d71c96d",
"shasum": ""
},
"require": {
"php": ">=8.0",
"utopia-php/database": "0.56.*"
"utopia-php/database": "0.58.*"
},
"require-dev": {
"laravel/pint": "1.5.*",
"phpstan/phpstan": "^1.8",
"phpunit/phpunit": "^9.3"
"laravel/pint": "1.*",
"phpstan/phpstan": "1.*",
"phpunit/phpunit": "9.*"
},
"type": "library",
"autoload": {
@@ -3274,9 +3274,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/audit/issues",
"source": "https://github.com/utopia-php/audit/tree/0.47.0"
"source": "https://github.com/utopia-php/audit/tree/0.49.0"
},
"time": "2025-01-15T02:40:53+00:00"
"time": "2025-02-04T07:27:18+00:00"
},
{
"name": "utopia-php/cache",
@@ -3476,22 +3476,22 @@
},
{
"name": "utopia-php/database",
"version": "0.56.4",
"version": "0.58.4",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "240478a60797124a885ceac40046fe47c22415b7"
"reference": "ff3fd22e4fe757cc2a78f17169f6dcc45c96d0fe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/240478a60797124a885ceac40046fe47c22415b7",
"reference": "240478a60797124a885ceac40046fe47c22415b7",
"url": "https://api.github.com/repos/utopia-php/database/zipball/ff3fd22e4fe757cc2a78f17169f6dcc45c96d0fe",
"reference": "ff3fd22e4fe757cc2a78f17169f6dcc45c96d0fe",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-pdo": "*",
"php": ">=8.3",
"php": ">=8.1",
"utopia-php/cache": "0.11.*",
"utopia-php/framework": "0.33.*",
"utopia-php/mongo": "0.3.*"
@@ -3526,9 +3526,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.56.4"
"source": "https://github.com/utopia-php/database/tree/0.58.4"
},
"time": "2025-01-20T09:22:08+00:00"
"time": "2025-02-05T02:51:02+00:00"
},
{
"name": "utopia-php/domains",
@@ -3929,35 +3929,35 @@
},
{
"name": "utopia-php/migration",
"version": "0.6.15",
"version": "0.6.17",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "e849ec3e7ad38f5f5273ebb0132b112639cdf01c"
"reference": "677a5c4688d7f54d1631a91f76a35d51346cf96b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/e849ec3e7ad38f5f5273ebb0132b112639cdf01c",
"reference": "e849ec3e7ad38f5f5273ebb0132b112639cdf01c",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/677a5c4688d7f54d1631a91f76a35d51346cf96b",
"reference": "677a5c4688d7f54d1631a91f76a35d51346cf96b",
"shasum": ""
},
"require": {
"appwrite/appwrite": "11.1.*",
"appwrite/appwrite": "11.*",
"ext-curl": "*",
"ext-openssl": "*",
"php": "8.3.*",
"utopia-php/database": "0.56.*",
"php": ">=8.1",
"utopia-php/database": "0.58.*",
"utopia-php/dsn": "0.2.*",
"utopia-php/framework": "0.33.*",
"utopia-php/storage": "0.18.*"
},
"require-dev": {
"ext-pdo": "*",
"laravel/pint": "1.17.*",
"phpstan/phpstan": "1.11.*",
"phpunit/phpunit": "11.2.*",
"laravel/pint": "1.*",
"phpstan/phpstan": "1.*",
"phpunit/phpunit": "11.*",
"utopia-php/cli": "0.16.*",
"vlucas/phpdotenv": "5.6.*"
"vlucas/phpdotenv": "5.*"
},
"type": "library",
"autoload": {
@@ -3979,9 +3979,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/0.6.15"
"source": "https://github.com/utopia-php/migration/tree/0.6.17"
},
"time": "2025-01-15T04:55:08+00:00"
"time": "2025-02-05T05:27:29+00:00"
},
{
"name": "utopia-php/mongo",
@@ -4,6 +4,7 @@ namespace Tests\E2E\Services\Projects;
use Appwrite\Auth\Auth;
use Appwrite\Extend\Exception;
use Appwrite\Tests\Async;
use Tests\E2E\Client;
use Tests\E2E\General\UsageTest;
use Tests\E2E\Scopes\ProjectConsole;
@@ -19,6 +20,7 @@ class ProjectsConsoleClientTest extends Scope
use ProjectsBase;
use ProjectConsole;
use SideClient;
use Async;
/**
* @group smtpAndTemplates
@@ -1411,18 +1413,20 @@ class ProjectsConsoleClientTest extends Scope
/**
* List sessions
*/
$response = $this->client->call(Client::METHOD_GET, '/account/sessions', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $id,
'Cookie' => $sessionCookie,
]);
$this->assertEventually(function () use ($id, $sessionCookie, $sessionId2) {
$response = $this->client->call(Client::METHOD_GET, '/account/sessions', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $id,
'Cookie' => $sessionCookie,
]);
$this->assertEquals(200, $response['headers']['status-code']);
$sessions = $response['body']['sessions'];
$this->assertEquals(200, $response['headers']['status-code']);
$sessions = $response['body']['sessions'];
$this->assertEquals(1, count($sessions));
$this->assertEquals($sessionId2, $sessions[0]['$id']);
$this->assertEquals(1, count($sessions));
$this->assertEquals($sessionId2, $sessions[0]['$id']);
});
/**
* Reset Limit
@@ -223,6 +223,8 @@ trait TeamsBaseClient
$this->assertEquals($email, $lastEmail['to'][0]['address']);
$this->assertEquals($name, $lastEmail['to'][0]['name']);
$this->assertEquals('Invitation to ' . $teamName . ' Team at ' . $this->getProject()['name'], $lastEmail['subject']);
$this->assertEquals($response['body']['teamId'], substr($lastEmail['text'], strpos($lastEmail['text'], '&teamId=', 0) + 8, 20));
$this->assertEquals($teamName, substr($lastEmail['text'], strpos($lastEmail['text'], '&teamName=', 0) + 10, 7));
$secret = substr($lastEmail['text'], strpos($lastEmail['text'], '&secret=', 0) + 8, 256);
$membershipUid = substr($lastEmail['text'], strpos($lastEmail['text'], '?membershipId=', 0) + 14, 20);
@@ -290,6 +292,8 @@ trait TeamsBaseClient
$this->assertEquals($secondEmail, $lastEmail['to'][0]['address']);
$this->assertEquals($secondName, $lastEmail['to'][0]['name']);
$this->assertEquals('Invitation to ' . $teamName . ' Team at ' . $this->getProject()['name'], $lastEmail['subject']);
$this->assertEquals($response['body']['teamId'], substr($lastEmail['text'], strpos($lastEmail['text'], '&teamId=', 0) + 8, 20));
$this->assertEquals($teamName, substr($lastEmail['text'], strpos($lastEmail['text'], '&teamName=', 0) + 10, 7));
// test for resending invitation
$response = $this->client->call(Client::METHOD_POST, '/teams/' . $teamUid . '/memberships', array_merge([