https://cerbos.dev logo
Title
c

Carl Bäckström

05/04/2023, 6:13 PM
Another question is it possible to check for the existance of a partial object in an array of object. let say we have
[{companyId: "company1"}, {companyId: "company2"}]
and I want to do something like
{companyId: request.principal.attr.companyId} in request.resource.attr.companies
a

Andrew Haines (Cerbos)

05/04/2023, 6:16 PM
Yep, you could use
exists
for this, something like
request.resource.attr.companies.exists(c, c.companyId == request.principal.attr.companyId)
c

Carl Bäckström

05/04/2023, 6:17 PM
Cool thankyou!