-
Notifications
You must be signed in to change notification settings - Fork 71
Description
The Document demo invite is becoming slow. It starts impacting the tests. This is because the ResourceArray of write 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 children
Thoughts:
- Maybe make the rights an enum instead of a bunch of booleans, as
writemeans thatappendis always true. Also, does awriteoftruecombined with areadoffalsemake any sense? - Should we allow multiple Agents in
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:
- When a Grant is edited, we need to check if the Agent requesting this has the rights to do this.
- We should probably prevent items from being grant-less: that nobody can edit them.
- Asking if someone has rigths to edit or view some resource should be very cheap.
What needs to be changed
- Create the Grant datamodel
- Make sure that Grants can only be created, read and edited by the right Agents.
- Update the share / rights view in Atomic-Data-Browser
- Update the invite flow
- Migrate existing data (or do we keep the old functionality?)