Open joepio opened 2 years ago
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:
write
and read
props, but don't use them in group settings, we prefer roles and memberships.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