Skip to content

Commit

Permalink
Convert item field in validateItemAccess to boolean (directus#24026)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanneskuettner authored Nov 12, 2024
1 parent d0c7491 commit 9e0bec9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/proud-deers-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@directus/api': patch
---

Fixed an issue in the item access validation that caused problems with CockroachDB
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Accountability, PermissionsAction, PrimaryKey } from '@directus/types';
import { toBoolean } from '@directus/utils';
import { fetchPermittedAstRootFields } from '../../../../database/run-ast/modules/fetch-permitted-ast-root-fields.js';
import type { AST } from '../../../../types/index.js';
import type { Context } from '../../../types.js';
Expand Down Expand Up @@ -51,7 +52,7 @@ export async function validateItemAccess(options: ValidateItemAccessOptions, con
const { fields } = options;

if (fields) {
return items.every((item: any) => fields.every((field) => item[field] === 1));
return items.every((item: any) => fields.every((field) => toBoolean(item[field])));
}

return true;
Expand Down

0 comments on commit 9e0bec9

Please sign in to comment.