-
Notifications
You must be signed in to change notification settings - Fork 176
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
HTML syntax for granular permissions #318
Comments
Would there be defaults if no permissions are set? Not syntax related, but if there are no defaults, the author has to set all permissions which would make syntax 1 a bit clearer. While if there are defaults, the user probably have to set less that would make syntax 2 clearer. On a element with My vote go to multiple attributes, and To be consistent I think
|
Would the *nix system type of permissions fit this? |
@joyously many of the common use cases I mentioned wouldn't be possible to define that way. |
I think depending on the Mavo app, it may be confusing to think of the "owner" of each item as a concept, whereas "my own items" is pretty straightforward regardless of the schema. |
A different idea would be to have very very simple attributes (basically yes/no for each permission) and offload the complexity to expressions. Then, we would expose any information needed to implement common permission patterns via special properties in expressions, and update it accordingly upon login/logout. The main drawback is that this would make it much harder to read this server-side and enforce the permissions, without requiring the author to specify them again. It would also make it much harder to automatically transform the permissions to whatever format the backend expects. Attributes could be something like Special properties that need to be exposed in expressions would be:
Then logged in becomes just |
Issues that are blocking this:
Anything else? |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
When Mavo started, we were only using flat files to store all Mavo app data remotely, and backends that were basically file stores. Therefore, there was no way of only being able to read/edit part of the data: either you were able to read/edit all of it, or none of it. The set of possible permissions were very small, and Mavo conveniently read it from the backend and applied it to the UI.
This works well for apps where the data is only managed by one person or a small team of people that trust each other, such as PIM apps and CMS-style applications. However, it makes several types of apps impossible, such as:
Thankfully, this restrictive assumption is challenged by new backends like Firebase. This means, there needs to be a way for Mavo authors to describe these granular permissions in their HTML. Ideally, the remote backend would read these permissions, verify them with the admin when they are logged, and set them remotely too. But even backends that require setting permissions separately need to reflect them into the UI somehow. Sure, the Backend could read them remotely, parse them and apply them, but that's an extra step that not all backend authors do.
We've already seen that backend authors tend to expect HTML authors to duplicate the permissions in their HTML, and have to invent their own syntax, which sometimes even goes against best practices:
mv-unauthenticated-permissions="read edit save"
attributepublic-read
,public-write
,user-write
in themv-app
attribute (!).Since this is a common need, we need to devise a syntax for it, and have Mavo process it, apply it in the UI, and expose it to the backends. This will also mean that backend authors are more likely to support granular permissions in that case, as it's much less work for them.
I will start trying to come up with a good syntax with some brainstorming:
Types of permissions
Currently, Mavo supports the following types of permissions:
Currently, Mavo reads these permissions from the backend, and exposes them on an
mv-permissions
attribute on the Mavo root. Themv-permissions
attribute is read-only, and setting it doesn’t do anything.User targets
The following scopes seem most useful, but perhaps I'm missing some:
The last three are probably the most useful, and should be included in even the tiniest MVP of this.
Possibly also combinations of the above, e.g. "logged in users except banned user group".
Potential syntaxes
read: everyone, add: logged-in, edit: own, delete: own
. If a permission is provided without a value, the implied value is "everyone".Name brainstorming for this attribute:
mv-permissions
,mv-can
,mv-enable
mv-can-read="everyone" mv-can-add="logged-in" mv-can-edit="own" mv-can-delete="own"
. If an attribute is used without a value, the implied value is "everyone".In both proposals, undeclared permissions would be inherited.
We need feedback about:
The text was updated successfully, but these errors were encountered: