I have tried the following predicate function, but It gives me a permissions error. It is referencing the terms, but am not sure how to select data.owner from the terms such that the user is returned and matches the Identity() in the function so that it returns true and allows me to only read the docs of the authed user with this Index.
I guess if I just remove the predicate function, there is no way for the user to pass a different identity becasue it is run on the server side, so I don’t need to check if they are the user in the predicate. Is this safe, because it will work then and it separates my index by the user like I want it to.
If your index has terms defined, the Dashboard would be unable to show matching entries unless the terms were specified. So I think there might be a problem with your index definition.
Can you show me the result of this query (run it on the Shell screen in the Dashboard):
Get(Index("item_number_reversed_owner"))
Secondly, CurrentIdentity can only return a value when a token is used for authentication. The secret for a key would result in the error:
{
errors: [
{
position: [],
code: 'missing identity',
description: 'Authentication does not contain an identity'
}
]
}
Do you need to use a Role? Roles are for granting permissions, not for filtering data.
well isn’t the role attached to my User by membership and that is what gives access to the faunaDB index, I just gave it read permissions, and am checking by currentIdenitty in the terms, and it is functioning as I like now.
But from my prespective I think this is resolved now. Let me know if I am missing something. thanks