CognxSafeTrack commited on
Commit ·
ffddff2
1
Parent(s): 7098b31
fix: exempt Organization model from tenant isolation
Browse files
packages/database/src/extension.ts
CHANGED
|
@@ -5,10 +5,12 @@ export const createTenantExtension = (explicitOrganizationId?: string) => {
|
|
| 5 |
return {
|
| 6 |
query: {
|
| 7 |
$allModels: {
|
| 8 |
-
async $allOperations({ operation, args, query }: any) {
|
| 9 |
const organizationId = explicitOrganizationId || getOrganizationId();
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
return query(args);
|
| 13 |
}
|
| 14 |
|
|
|
|
| 5 |
return {
|
| 6 |
query: {
|
| 7 |
$allModels: {
|
| 8 |
+
async $allOperations({ model, operation, args, query }: any) {
|
| 9 |
const organizationId = explicitOrganizationId || getOrganizationId();
|
| 10 |
|
| 11 |
+
// 🚨 EXCEPTION: Certain models should never be filtered by organizationId
|
| 12 |
+
const EXCLUDED_MODELS = ['Organization', 'TrainingData'];
|
| 13 |
+
if (EXCLUDED_MODELS.includes(model) || !organizationId) {
|
| 14 |
return query(args);
|
| 15 |
}
|
| 16 |
|