-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor grants / rights - don't use a ResourceArray #476
Comments
Design session with @Polleps |
Let's walk through how a rights query would be resolved using the graph above. We start with an Agent and a Resource - how do we answer the question if some Agent A has a specific right at a specific resource X?
This is very computationally expensive! How do we make this a tad easier?
But I think we can speed this up more:
This seems to be decently fast on paper. But would it allow users to set rights wihout roles? E.g. John gives Sarah read access? Some solutions:
Should links from Resource to Grant be defined in the Grant or in the Resource? If it's in the Resource, we often get slightly better performance - no need to hit the value index. However, this is not a big impact. Also, it becomes easier to reason about write access to the Grant, because it is in the Resource itself. On the other hand, it will be harder to query on Grants or find all Grants for a person. |
The
Document demo invite
is becoming slow. It starts impacting the tests. This is because the ResourceArray ofwrite
Agents in the document is starting to contain a lot of URLs. Every time we add one item to it, the back-end has to process quite a bit of data. I know I can find some ways to improve this performance, but the architecture is fundamentally unscalable. Keeping Agent references inside Resources will severely limit how many people will get access to one document.Basically, currently we use node-based rights. We should consider going to edge-based rights.
One solution is to introduce Groups or Roles.
Another solutions is to put the relationship of
Resource :write -> User
in a seperate Grant resource:Resource <- :forResource Grant :forUser -> User
.This will be quite the refactor! But I think it needs to be done...
Grant Datamodel
resource
(resource): the resource that grants are applied towho
(resource, Agent): the Agent who receives the rightsread
(bool): allows viewing the datawrite
(bool): allows any edits (including deletion) and any childrenappend
(bool): allows creating childrenThoughts:
write
means thatappend
is always true. Also, does awrite
oftrue
combined with aread
offalse
make any sense?who
? If we do, we may get the same problem that we're currently trying to solve.Editing, querying and viewing Grants
Inspiration for testing scenarios:
What needs to be changed
The text was updated successfully, but these errors were encountered: