fix rls create new record with composite (#17243)

## Context
buildValueFromFilter was not handling composite filters which was needed
for RLS. This PR implements that and fix some issues with RLS

Tested with a few composite + relation fields
<img width="559" height="206" alt="Screenshot 2026-01-19 at 15 38 42"
src="https://github.com/user-attachments/assets/d64afa6e-3e12-4843-a215-a693665112c5"
/>
This commit is contained in:
Weiko
2026-01-20 06:36:38 +01:00
committed by GitHub
parent 39470b74a4
commit b64951634e
17 changed files with 906 additions and 202 deletions
@@ -283,8 +283,15 @@ export class WorkspaceInsertQueryBuilder<
? this.expressionMap.valuesSet
: [this.expressionMap.valuesSet];
const valuesToInsertFormatted = formatResult<T[]>(
valuesToInsert,
objectMetadata,
this.internalContext.flatObjectMetadataMaps,
this.internalContext.flatFieldMetadataMaps,
);
validateRLSPredicatesForRecords({
records: valuesToInsert,
records: valuesToInsertFormatted,
objectMetadata,
internalContext: this.internalContext,
authContext: this.authContext,
@@ -177,7 +177,7 @@ export class WorkspaceUpdateQueryBuilder<
this.applyRowLevelPermissionPredicates();
const valuesSet = this.expressionMap.valuesSet ?? {};
const updatedRecords: T[] = formattedBefore.map(
const updatedRecords: T[] = before.map(
(record, index) =>
({
...record,
@@ -571,8 +571,15 @@ export class WorkspaceUpdateQueryBuilder<
this.internalContext,
);
const updatedRecordsFormatted = formatResult<T[]>(
updatedRecords,
objectMetadata,
this.internalContext.flatObjectMetadataMaps,
this.internalContext.flatFieldMetadataMaps,
);
validateRLSPredicatesForRecords({
records: updatedRecords,
records: updatedRecordsFormatted,
objectMetadata,
internalContext: this.internalContext,
authContext: this.authContext,