magaf
07/24/2023, 11:51 AMvroldanbet
07/24/2023, 12:28 PMat_exact_snapshot consistency to get the same results across all permissions
2. it's currently not possible to determine if a ZedToken is newer than another one. Feel free to add your use case in https://github.com/authzed/spicedb/issues/1162magaf
07/24/2023, 12:44 PMvroldanbet
07/25/2023, 9:28 AMwriter role by writing a specific relationship that grants them permission, or you could be talking about the synthethic permission defined in your SpiceDB schema, e.g. permission can_write = writer + admin
For example, you could read all the resources of a given type a user has a relationship with using ReadRelationships by passing a filter without resource_id and providing resource_type, subject_type and subject_id.
If you still feel like using the synthethic permission is what you want to show (I could imagine some sort of debugging / staff UI to understand what permissions a user have been given) LookupResources would give you that.
Now, wr.t. at_extact_snapshot, you are totally right. The right way to go would be to do an initial call with minimize_latency and then do all subsequent calls with the zedtoken returned back on that initial call.
>I wonder how such situations don't rise more often, are ZedToken normally only used within the context of some larger operation and then discarded rather then saved somewhere in which cases some comparison is likely needed?
The problem here is that ZedTokens are meant to be written alongside the content change, so if you are writing it to another system of record, in this case Redis, you'll find yourself in the race you are trying to solve. Are you storing your business objects also in Redis?magaf
07/25/2023, 9:07 PMLookupResources is indeed what I'm looking for, I guess in the future the API requirement to request a single permission might be dropped, but meanwhile your suggestion could work.
Is the looked_up_at token in the LookupResourcesResponse guaranteed to be the same for all resources in the LookupResources response?
Edit: also LookupResources for some permission might not find any matches in which case we wouldn't have a token, is the alternative making a dummy CheckPermission request?
Regarding the storage of ZedToken, after some more reading I see what you mean, the below discussion also helped:
https://github.com/authzed/spicedb/issues/1117
Storing the token at the "organization level"/"top level" is simillar to what I was looking for, and in that use case sounds like some kind of locking is the way to go.vroldanbet
07/26/2023, 11:44 AMpermission noop = nil .
You can also do SchemaRead which returns also readAtvroldanbet
07/26/2023, 11:45 AMvroldanbet
07/26/2023, 11:45 AMvroldanbet
07/26/2023, 11:46 AMmagaf
07/26/2023, 8:27 PMZedToken, would you recommend a specific option? leaning towards SchemaRead but might check later if there's a big difference.
Yeah lock contention could be an issue, good to hear you are thinking on that problem 🙂vroldanbet
07/27/2023, 9:44 AMnil would be probably very cheap, because all it would have to do is to compute the optimized revision and maybe some schema validation based on the input argumentsvroldanbet
07/27/2023, 9:46 AM