From abb7d1cb66b36a4f0cb94d259934bb4f2499a3d1 Mon Sep 17 00:00:00 2001 From: Remko Date: Tue, 21 Apr 2026 15:21:04 +0200 Subject: [PATCH] fix: resolve $now in raw SQL RBAC conditions, unblocking date-based access Co-authored-by: Robert Zondervan --- lib/Db/MagicMapper/MagicRbacHandler.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Db/MagicMapper/MagicRbacHandler.php b/lib/Db/MagicMapper/MagicRbacHandler.php index 502ec45c5a..af593e94f9 100644 --- a/lib/Db/MagicMapper/MagicRbacHandler.php +++ b/lib/Db/MagicMapper/MagicRbacHandler.php @@ -1261,8 +1261,15 @@ private function buildComparisonOperatorConditionSql( return null; } - $sqlOperator = $comparisonMap[$operator]; - $quotedValue = $this->quoteValue(value: $operand); + $sqlOperator = $comparisonMap[$operator]; + $resolvedOperand = $this->resolveDynamicValue(value: $operand); + + // If dynamic variable resolved to null, this condition cannot be met. + if ($operand !== $resolvedOperand && $resolvedOperand === null) { + return null; + } + + $quotedValue = $this->quoteValue(value: $resolvedOperand); return "{$columnName} {$sqlOperator} {$quotedValue}"; }//end buildComparisonOperatorConditionSql()