Skip to content

Commit 3599f46

Browse files
committed
update
1 parent 9c49d8b commit 3599f46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/plugins/policy/src/policy-handler.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,15 @@ export class PolicyHandler<Schema extends SchemaDef> extends OperationNodeTransf
248248
if (!beforeUpdateAccessFields || beforeUpdateAccessFields.length === 0) {
249249
return undefined;
250250
}
251+
252+
// combine update's where with policy filter
253+
const policyFilter = this.buildPolicyFilter(model, model, 'update');
254+
const combinedFilter = where ? conjunction(this.dialect, [where.where, policyFilter]) : policyFilter;
255+
251256
const query: SelectQueryNode = {
252257
kind: 'SelectQueryNode',
253258
from: FromNode.create([TableNode.create(model)]),
254-
where,
259+
where: WhereNode.create(combinedFilter),
255260
selections: [...beforeUpdateAccessFields.map((f) => SelectionNode.create(ColumnNode.create(f)))],
256261
};
257262
const result = await proceed(query);

0 commit comments

Comments
 (0)