Skip to content

Question: Where to store ZedToken if the resources are in a tree structure? #1117

@henkosch

Description

@henkosch

We have a hierarchical resource structure similar to a folder tree. Let's say we have a similar setup to google drive, where resources are files and they are in folders. Folders could have folders in them. You can assign permissions for users on folders which will give them access to any of the files in that folder or any of its subfolders transitively. You can assign a single user or a group of users to a folder where a group of users could also contain other groups of users.

The question is: Where should I store my ZedTokens after I write a relationship?
(Create a file, create a user, assign someone permission, add someone to a group, etc)

The documentation says that I should store the returned ZedToken in the parent resource. But there is a full chain of parents in this case. Which parent? Should I store in with the top most folder? That I think would be the safest option, because that would mean any change in any of the relationships would result in a new ZedToken for the whole tree. Although it would also be a bottleneck because I would have to store it with proper locking in place. Also it would not add much performance gain compared to a fully consistent read when performing lookup resources.

But if I consider storing it with any other folder down the tree, I could potentially miss a permission change that was happening upper in the tree.

What would be the best practice in this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/questionClarifying a question without code changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions