mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix: add expiration check for presence updates to prevent outdated entries
This commit is contained in:
1 parent
a8670ee8fb
commit
2c2e8bcabd
1 file changed
+6
@@ -13,6 +13,7 @@ use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Database\Documents\User;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\DateTime;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Database\Exception\Conflict as ConflictException;
|
||||
use Utopia\Database\Exception\Duplicate;
|
||||
@@ -138,6 +139,11 @@ class Update extends PlatformAction
|
||||
throw new Exception(Exception::PRESENCE_NOT_FOUND, params: [$presenceId]);
|
||||
}
|
||||
|
||||
$presenceExpiresAt = $presence->getAttribute('expiresAt');
|
||||
if (!empty($presenceExpiresAt) && DateTime::formatTz($presenceExpiresAt) < DateTime::formatTz(DateTime::now())) {
|
||||
throw new Exception(Exception::PRESENCE_NOT_FOUND, params: [$presenceId]);
|
||||
}
|
||||
|
||||
$updateData = [];
|
||||
|
||||
if ($userId !== null) {
|
||||
|
||||
Reference in new issue
Block a user