Matthew Ebeweber
09/06/2022, 10:03 PMqueryPlanToPrisma
logic to convert a cerbos response to a prisma query and am running into some trouble. Auditing the call, the planResources
call is returning something formed from --
{
"kind": "KIND_CONDITIONAL",
"condition": {
"expression": {
"operator": "eq",
"operands": [
{
"value": "qid::tenant:foo"
},
{
"variable": "request.resource.attr.tenantQid"
}
]
}
}
}
but then when I pass the result into queryPlanToPrisma
with a pretty simple mapping { 'request.resource.attr.tenantQid': 'tenantQid'}
, I get filtering conditions that are { undefined: { equals: "undefined" } }
. I haven't gone too deep into the logic or tried other conditions, but was curious if I was doing something obviously wrong.planResources
call and play with the shape of the response I can get it to behave how I would expect.
For example, this..
condition: {
operator: "eq",
operands: [
{
name: "request.resource.attr.tenantQid",
},
{
value: "qid::tenant:foo",
}
]
},
does give me this..
Object {
"tenantQid": Object {
"equals": "qid::tenant:foo",
},
}
Alex Olivier (Cerbos)
09/07/2022, 6:26 AMMatthew Ebeweber
09/07/2022, 2:15 PM"@cerbos/grpc": "^0.7.0",
"@cerbos/orm-prisma": "^0.1.1",
"cerbos": "^0.4.0",
Really appreciate your help here 🙂 let me know if I can provide you with anything else<http://ghcr.io/cerbos/cerbos:latest|ghcr.io/cerbos/cerbos:latest>
Alex Olivier (Cerbos)
09/07/2022, 2:17 PM@cerbos/grpc
is the correct SDK, the cerbos
one is deprecated now. which are you using in your code? this is likely the culrpitMatthew Ebeweber
09/07/2022, 2:20 PMgrpc
in the code, I just uninstalled cerbos
and the output is the sameAlex Olivier (Cerbos)
09/07/2022, 2:21 PMplanResources
call?Matthew Ebeweber
09/07/2022, 2:24 PMAlex Olivier (Cerbos)
09/07/2022, 2:53 PM@cerbos/orm-prisma@0.1.2