@@ -608,13 +608,13 @@ export class PolicyUtil extends QueryUtils {
608608            //   to-one: direct-conditions/is/isNot 
609609            //   regular fields 
610610            const  mergedGuard  =  this . buildReadGuardForFields ( db ,  model ,  args . where ,  { } ) ; 
611-             this . mergeWhereClause ( args . where ,  mergedGuard ) ; 
611+             args . where   =   this . mergeWhereClause ( args . where ,  mergedGuard ) ; 
612612        } 
613613
614614        if  ( args . where )  { 
615615            if  ( injected . where  &&  Object . keys ( injected . where ) . length  >  0 )  { 
616616                // merge injected guard with the user-provided where clause 
617-                 this . mergeWhereClause ( args . where ,  injected . where ) ; 
617+                 args . where   =   this . mergeWhereClause ( args . where ,  injected . where ) ; 
618618            } 
619619        }  else  if  ( injected . where )  { 
620620            // no user-provided where clause, use the injected one 
@@ -630,7 +630,7 @@ export class PolicyUtil extends QueryUtils {
630630            if  ( ! args . where )  { 
631631                args . where  =  this . and ( ...hoistedConditions ) ; 
632632            }  else  { 
633-                 this . mergeWhereClause ( args . where ,  this . and ( ...hoistedConditions ) ) ; 
633+                 args . where   =   this . mergeWhereClause ( args . where ,  this . and ( ...hoistedConditions ) ) ; 
634634            } 
635635        } 
636636
@@ -1552,7 +1552,11 @@ export class PolicyUtil extends QueryUtils {
15521552        } 
15531553
15541554        if  ( this . isTrue ( extra ) )  { 
1555-             return ; 
1555+             return  where ; 
1556+         } 
1557+ 
1558+         if  ( this . isFalse ( extra ) )  { 
1559+             return  this . makeFalse ( ) ; 
15561560        } 
15571561
15581562        // instead of simply wrapping with AND, we preserve the structure 
@@ -1565,10 +1569,10 @@ export class PolicyUtil extends QueryUtils {
15651569            const  combined : any  =  this . and ( ...conditions ) ; 
15661570
15671571            // make sure the merging always goes under AND 
1568-             where . AND   =   combined . AND  ??  combined ; 
1572+             return   {  ... where ,   AND :  combined . AND  ??  combined   } ; 
15691573        }  else  { 
15701574            // insert an AND clause 
1571-             where . AND   =   [ extra ] ; 
1575+             return   {  ... where ,   AND :  [ extra ]   } ; 
15721576        } 
15731577    } 
15741578
0 commit comments