Skip to content

Commit

Permalink
feat: add isNotNull check for cypher return variable in Auth cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mjfwebb committed Sep 27, 2024
1 parent 025705c commit 3b9acaa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class CypherFilter extends Filter {
});

if (this.checkIsNotNull) {
return Cypher.and(Cypher.isNotNull(this.comparisonValue), operation);
return Cypher.and(Cypher.isNotNull(this.comparisonValue), Cypher.isNotNull(this.returnVariable), operation);
}

return operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe("cypher directive filtering - Auth", () => {
RETURN this0 AS var1
}
WITH *
WHERE ($isAuthenticated = true AND ($jwt.custom_value IS NOT NULL AND var1 = $jwt.custom_value))
WHERE ($isAuthenticated = true AND ($jwt.custom_value IS NOT NULL AND var1 IS NOT NULL AND var1 = $jwt.custom_value))
RETURN this { .title } AS this"
`);

Expand Down Expand Up @@ -248,7 +248,7 @@ describe("cypher directive filtering - Auth", () => {
RETURN this1 AS var2
}
WITH *
WHERE ($jwt.custom_value IS NOT NULL AND var2 = $jwt.custom_value)
WHERE ($jwt.custom_value IS NOT NULL AND var2 IS NOT NULL AND var2 = $jwt.custom_value)
RETURN count(this0) > 0 AS var3
}
WITH *
Expand Down Expand Up @@ -321,7 +321,7 @@ describe("cypher directive filtering - Auth", () => {
RETURN this0 AS var1
}
WITH *
WHERE ($isAuthenticated = true AND ($jwt.custom_value IS NOT NULL AND var1 = $jwt.custom_value))
WHERE ($isAuthenticated = true AND ($jwt.custom_value IS NOT NULL AND var1 IS NOT NULL AND var1 = $jwt.custom_value))
RETURN this { .title } AS this"
`);

Expand Down Expand Up @@ -392,7 +392,7 @@ describe("cypher directive filtering - Auth", () => {
RETURN this0 AS var1
}
WITH *
WHERE apoc.util.validatePredicate(NOT ($isAuthenticated = true AND ($jwt.custom_value IS NOT NULL AND var1 = $jwt.custom_value)), \\"@neo4j/graphql/FORBIDDEN\\", [0])
WHERE apoc.util.validatePredicate(NOT ($isAuthenticated = true AND ($jwt.custom_value IS NOT NULL AND var1 IS NOT NULL AND var1 = $jwt.custom_value)), \\"@neo4j/graphql/FORBIDDEN\\", [0])
RETURN this { .title } AS this"
`);

Expand Down

0 comments on commit 3b9acaa

Please sign in to comment.