-
Notifications
You must be signed in to change notification settings - Fork 7
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
Hierarchy, folders, authorization and nested (parent-child) relationships #18
Comments
I've been working on atomic-data-browser for a couple of weeks, and playing around with that made me feel even more hungry for some hierarchy. Some things that I want:
ApproachesEvery item has a parent, only tags (folders) can be parents
Every item has a parent, any resource can be a parent
Parents are optional
|
I think that making every item parentable is a pretty clean solution. Doing this means that every Atomic Data Server needs a root node. As a term, I feel like But how should we order the rest of the content? Maybe the Drive has |
Rights and grants (read / write access)We'll definitely use the Hierarchy model to provide (or possibly restrict) write and read access to resources. How should this work? Additive modelI think we'll need an additive model, which means that parents can only add permissive rights to resources. This helps to keep performance decent - if anywhere in a tree we see that the correct grant is present, we can execute the command. We don't have to evaluate the entire tree. This does, however, mean that it will not be possible to prevent children to be more restrictive than parents. There are situations where this will feel awkward. For example, when dealing with comments on something. We might think of comments as being children of some parent commnt / thread, but we generally don't allow the OP to get edit rights to all its comments. Properties
|
FoldersEven though any resource can be a Parent, we might want to use folders, too. These might contain items that are foreign, so they are not necessarily strictly children of the Folder. |
I've been thinking about bidirectionality. For now, childrens describe their parents - but parents do not have to set their children. Parents can add rights, and in that case it only makes sense if children describe their parents, not the other way around. Otherwise, we could have some new resource that maliciously pretends to be the parent of a child, and then gains write rights to something. Not good, so we need children to be in charge of who their parents are. Yay, children! But... Sometimes, we need to find children by navigating parents. For example, when opening the navigation sidebar in the Atomic Data Browser. Currently, we calculate the children at runtime, basically by querying the database. This has some performance cost, so at the moment we only do this for Drive resources (which are the top level items that appear in the sidebar). This, of course, does not cover all usecases for finding children, because all resources can have children! I think we have a couple of solutions: Use a collection / endpoint for finding childrenIf the front-end needs to know who the children are, simply create a Collection and perform the query. This means front-ends will need to have logic for doing this. Only allow Drives / specific resources to have childrenThis means - treat Drives like folders in a Filesystem. Only these Drives / Folders can have children. The This is kind of limiting, because it often feels logical to have a parent relationship to something that's not a folder. Although, to be honest, I can't really think of important usecases at this moment. Hmm. |
This is going to be a mess of various thoughts regarding hierarchies - sorry for the lack of structure
On desktops, we generally use folders and sub-folders for various goals:
If Atomic Data is to be just as useful as a Unix filesystem or a Google Drive, we need to find solutions for the earlier mentioned five goals, too.
So let's check out some approaches to hierarchy
Approaches to hierarchy
Classic Unix-style file/folder model
This is the one we're most familiar with. Each files has a path, and only one parent.
The five goals in the intro describe where we use these paths for.
That's a lot of responsibilities for a single string, but that has some merits:
But it also causes issues:
Nested tagging
In this approach, resources can be linked to Tags. A Tag is like a parent folder, but its a 1-n relationship. Every resource can have multiple Tags - contrary to how folders work in most systems. Google drive does use a tag-like model, though. A folder can be placed in multiple places.
Tags can be nested, like folders. Should circular tags be possible? If they are, then implementations need to be very much aware of this, to prevent getting stuck in some loop.
These tags could be easily used for authorization. If you want to find out if an agent can read something, check the tag of the resource. Then, check the
agents-read-access
property (an array of Agents), and check if the requester is present in that array. If that is not the case, check thegroups-read-access
property (an array of Groups), and check if the requester is present in that group.We could use an additive rights model for authorization. Check all the tags of a resource (and all parent tags of these tags) to find out whether the user has the correct rights. If the correct rights are present in any of the tags, you're good to go.
Folders are often also used for calculating disk space. This might be a bit harder with tags - you don't want to count items with multiple tags in each parent. So how do you decide how big a tag is, in bytes? One solution is to have like a 'main' tag, which perhaps is simply the first tag. Only that one is counted.
The text was updated successfully, but these errors were encountered: