Skip to content
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

Project permission management #311

Closed
YousefED opened this issue Mar 29, 2022 · 1 comment
Closed

Project permission management #311

YousefED opened this issue Mar 29, 2022 · 1 comment

Comments

@YousefED
Copy link
Collaborator

YousefED commented Mar 29, 2022

Exploring different ideas on how we can implement "Projects": multiple documents with parent / child relationships and permission management.

Must have
User must be able to:

  • create a project
  • create new pages in a project
  • create subpages of existing pages in a project
  • move pages in a project to a different location in the project-tree
  • share a project with other users

should have

  • add pages to the project (or sub tree) that are not created in the scope of the project (i.e.: by a different user, or pre-existing pages). This probably means pages can have multiple parents
  • share pages and subpages with users. Child pages should inherit permissions from its parent
  • creating projects and moving documents should work offline, i.e. when not connected to matrix

Research re. Matrix permission management

Atm, we can set permissions for Rooms. Matrix has introduced Spaces, but is still figuring out authentication rules around this. Relevant MSCs:

Summary: this is not covered yet by Matrix, and part if this (cascading room permissions) was at least identified in 3083.

Brainstorming possible fixes:

  1. ensuring the permissions "one by one" when moving a room. Difficulties:
    -- Would need a separate way to track whether a user that has joined, has joined "via the old parent room's permission", or has been invited directly to the child room.
  2. Password protecting rooms, and posting the password in parent room (Matrix doesn't support password protected rooms yet)
  3. Matrix plugin / application service that manages these kind of permissions
  4. Storing "child docs" inside the parent doc. Disadvantages:
    -- diverts from the "typecell model" (documents live as separate entities in a web"
    -- permissions not manageable per child doc
    -- loss of crdt based collaboration when moving child docs to a different parent

Other related challenges:

  • if we store parent / child relationships in a document, how do we make sure they are in-sync with each other (avoid race conditions).

Maybe the most realistic option for now is to use a Space hierarchy and permission management from MSC3083. Later, we need to extend this (maybe with the help of Matrix folks) to make sure permissions are retracted when moving items to a different parent.

Challenges with this:

  • make sure space hierarchy and document rels are in-sync. Ideally it would be possible to move documents around while offline, and sync up to matrix later
  • at some point we should fix revocation, or warn the user when moving a document that user access is not revoked.
  • How to make sure document power levels are in sync / copied?
@YousefED
Copy link
Collaborator Author

For v1, what happens when a child doc is added / moved:

  • Set a parent relationship on the child doc
  • Set a child relationship on the parent doc
  • Remove child relationship on previous parent doc
  • Set the membership access of the child doc using MSC3083

How do we make this atomic / resilient?

When changing a parent:

  1. update parent.child
  2. update child.parent, remove oldParent.child

We could make a "reactive" system with the following rules.

a. when parent.child exists, make sure child.parent exists (if not, update child.parent and remove oldParent.child)
b. when child.parent exists, make sure membership is ok

This breaks however, when a different client checks step (a) from the perspective of oldParent. How does it know oldParent is "old"? This could be resolved using a relationClock=3, which indicates the version of the relation.

If step (b) fails (because user is offline). We should add the document to a local action-list so it will be loaded + synced + fixed next time we're online.

This approach might be ok for now. Further issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant