Skip to content

Commit 516ed26

Browse files
committed
(fix): restore Tenancy write hook registration in syncWriteHooks for shared tables
1 parent e1a5cea commit 516ed26

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/Database/Adapter/SQL.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use Utopia\Database\Helpers\ID;
2626
use Utopia\Database\Hook\PermissionFilter;
2727
use Utopia\Database\Hook\Permissions;
28+
use Utopia\Database\Hook\Tenancy;
2829
use Utopia\Database\Hook\TenantFilter;
2930
use Utopia\Database\Hook\WriteContext;
3031
use Utopia\Database\Index;
@@ -2889,6 +2890,11 @@ protected function syncWriteHooks(): void
28892890
if (empty(array_filter($this->writeHooks, fn ($h) => $h instanceof Permissions))) {
28902891
$this->addWriteHook(new Permissions());
28912892
}
2893+
2894+
$this->removeWriteHook(Tenancy::class);
2895+
if ($this->sharedTables && $this->tenant !== null) {
2896+
$this->addWriteHook(new Tenancy($this->tenant));
2897+
}
28922898
}
28932899

28942900
/**

0 commit comments

Comments
 (0)