hello guys, i'm creating a condition that checks i...
# help
m
hello guys, i'm creating a condition that checks if any of the objects inside entities contains a role called 'USER' but it always returns false even though i have an object with the role of 'USER'.Is it something wrong with my condition ? Example of entities => entities { <uuid>: { role: 'USER' }, <uuid>: { role: 'MANAGER' } }
a
Hey
Inside the map, you just need to do
.map(x, x.role === 'USER')
correction
.exists(x, x.role == 'USER')
exists checks for atleast one matching predicate, whilst map is for transforming the list
m
thanks Alex
a
Whats your use case for Cerbos?
m
In a few words one user can have different locations with different roles. And based on the roles i check the permission
a
Sounds a perfect use case for Cerbos 🙂 If you want we run free workshops to help you get started - you can book it here if you would like https://go.cerbos.io/workshop
m
will do when i'll need help. thanks a lot