diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 6a3799416..cfd65f13d 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -602,7 +602,7 @@ App::post('/v1/account/sessions/anonymous') throw new Exception('Failed to create anonymous user.', 401); } - if ($user->getId()) { + if (!$user->isEmpty()) { throw new Exception('Cannot create an anonymous user when logged in.', 401); } @@ -662,7 +662,8 @@ App::post('/v1/account/sessions/anonymous') Authorization::setRole('user:'.$user->getId()); - $user = $dbForInternal->updateDocument('users', $user->getId(), $user); + $user = $dbForInternal->updateDocument('users', $user->getId(), + $user->setAttribute('sessions', $session, Document::SET_TYPE_APPEND)); $audits ->setParam('userId', $user->getId()) diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php index 588651f70..e18f2e7e1 100644 --- a/app/controllers/api/teams.php +++ b/app/controllers/api/teams.php @@ -456,7 +456,6 @@ App::get('/v1/teams/:teamId/memberships') ]), Response::MODEL_MEMBERSHIP_LIST); }); - App::patch('/v1/teams/:teamId/memberships/:membershipId') ->desc('Update Membership Roles') ->groups(['api', 'teams']) diff --git a/src/Appwrite/Extend/PDO.php b/src/Appwrite/Extend/PDO.php index d5b2cab94..a46da92e0 100644 --- a/src/Appwrite/Extend/PDO.php +++ b/src/Appwrite/Extend/PDO.php @@ -77,6 +77,7 @@ class PDO extends PDONative $result = $this->pdo->rollBack(); } catch (\Throwable $th) { $this->pdo = $this->reconnect(); + return false; } return $result;