WorldBrain / storex

Storex Core - A modular and portable database abstraction ecosystem for JavaScript
MIT License
150 stars 8 forks source link

Feature: Unified access control definition #6

Closed ShishKabab closed 5 years ago

ShishKabab commented 6 years ago

Motivation: When dealing with data accessible by multiple users, there needs to be some access control logic. In traditional back-ends, an application server has a knows which user is logged in and checks rights before modifying the database. BaaS like Firebase services tend to have their own way of specifying access control. When dealing with decentralization, either P2P or Blockchain, logic also must be defined, sometimes in a specialized language. However, there are common denominators of access control that can be distilled across all these platforms, allowing us to declare access control rules before deciding on a backend.

Design considerations:

Questions:

Vague concept:

{
    project: {
        ownershipField: 'owner',
        membershipField: 'members',
        rules: [
            {role: 'owner', relationships: ['members'], grants: ['add_connection', 'remove_connection']},
            {role: 'member', fields: ['title', 'description'], grants: ['write']},
        ]
    }
}

Steps:

blackforestboi commented 5 years ago

Terminology used:

Here are some use cases that we should foresee:

Prio 1 (everything that needs to work for initial version)

Backups & Sync:

Collections:

Prio 2 (everything that needs to work for later (e.g. collaboration)

Open questions

ShishKabab commented 5 years ago

Thanks for the list, really useful :)

how to enforce deletions in a collaborative environment? In an offline-first environment anyone could just "keep" a post. How do we handle that?

We don't. There's no way to guarantee that everybody is really deleting data locally, ever, using any technology currently available. The best we can hope for is that they're using an unmodified version of whatever client they're using.

ShishKabab commented 5 years ago

Now included in https://github.com/WorldBrain/storex-pattern-modules