mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Merge branch 'main' into chore-sync-with-main
This commit is contained in:
commit
47ed708293
2 changed files with 31 additions and 1 deletions
|
|
@ -453,7 +453,7 @@ App::post('/v1/teams/:teamId/memberships')
|
||||||
if (empty($invitee)) { // Create new user if no user with same email found
|
if (empty($invitee)) { // Create new user if no user with same email found
|
||||||
$limit = $project->getAttribute('auths', [])['limit'] ?? 0;
|
$limit = $project->getAttribute('auths', [])['limit'] ?? 0;
|
||||||
|
|
||||||
if ($limit !== 0 && $project->getId() !== 'console') { // check users limit, console invites are allways allowed.
|
if (!$isPrivilegedUser && !$isAppUser && $limit !== 0 && $project->getId() !== 'console') { // check users limit, console invites are allways allowed.
|
||||||
$total = $dbForProject->count('users', [], APP_LIMIT_USERS);
|
$total = $dbForProject->count('users', [], APP_LIMIT_USERS);
|
||||||
|
|
||||||
if ($total >= $limit) {
|
if ($total >= $limit) {
|
||||||
|
|
|
||||||
|
|
@ -1238,6 +1238,36 @@ class ProjectsConsoleClientTest extends Scope
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// Creating A Team
|
||||||
|
$team = $this->client->call(Client::METHOD_POST, '/teams', array_merge([
|
||||||
|
'origin' => 'http://localhost',
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $id,
|
||||||
|
'x-appwrite-mode' => 'admin',
|
||||||
|
], $this->getHeaders()), [
|
||||||
|
'teamId' => ID::unique(),
|
||||||
|
'name' => 'Test Team 1',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(201, $team['headers']['status-code']);
|
||||||
|
|
||||||
|
$teamId = $team['body']['$id'];
|
||||||
|
$email = uniqid() . 'user@localhost.test';
|
||||||
|
|
||||||
|
// Creating A User Using Team membership
|
||||||
|
$response = $this->client->call(Client::METHOD_POST, '/teams/' . $teamId . '/memberships', array_merge($this->getHeaders(), [
|
||||||
|
'origin' => 'http://localhost',
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $id,
|
||||||
|
'x-appwrite-mode' => 'admin',
|
||||||
|
]), [
|
||||||
|
'email' => $email,
|
||||||
|
'roles' => [],
|
||||||
|
'url' => 'http://localhost',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertEquals(201, $response['headers']['status-code']);
|
||||||
|
|
||||||
$email = uniqid() . 'user@localhost.test';
|
$email = uniqid() . 'user@localhost.test';
|
||||||
|
|
||||||
$response = $this->client->call(Client::METHOD_POST, '/account', array_merge([
|
$response = $this->client->call(Client::METHOD_POST, '/account', array_merge([
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue