Hi all,
I’m struggling with the Read access predicate function that should allow the logged in user whose secret has created the fauna client to read their own document
Lambda(["ref"], Equals(CurrentIdentity(), Var("ref")))
isn’t working for me, although
Lambda(["oldData", "newData", "ref"], Equals(CurrentIdentity(), Var("ref")))
is working fine for the write predicate…
Specifically the permission denied error is getting thrown when I call a UDF and if I give all members in the security role blanket read access then the Function works fine.
Query(
Lambda(
["name", "amount", "minimum_amount", "update_amount", "supplier"],
Let(
{
userRef: CurrentIdentity(),
kitchenRef: Select(["data", "kitchen"], Get(CurrentIdentity()))
},
Create(Collection("stock"), {
data: {
created_by: Var("userRef"),
name: Var("name"),
kitchen: Var("kitchenRef"),
amount: Var("amount"),
minimum_amount: Var("minimum_amount"),
update_amount: Var("update_amount"),
supplier: Var("supplier")
}
})
)
)
)
Any help is most appreciated, not having much luck finding any solutions, I found some similar posts here and I’ve tried adjusting the Lambda([“ref”], / Lambda(“ref”, etc but no luck. Pretty new to fauna, thanks in advance!