Is CouchDB per-user database approach feasible for users with lots of shared data?

天涯浪子 提交于 2019-12-04 01:21:06
victorsavu3

You can enforce read permissions as described in CouchDB Authorization on a Per-Database Basis.

For write permissions you can use validation functions as described on CouchDB The Definitive Guide - Security.

You can create a database for each project and enforce the permissions there, then all the data is shared efficiently between the users. If a user shares a feed himself and needs permissions on that as well you can make the user into a "project" so the same logic applies everywhere.

Using this design you can authorize a user or a group of users (roles) for each project.

smathy

Other than (as victorsavu3 has suggested already) handling your read auth in a proxy between your app and couch, there are only two other alternatives that I can think of.

First is to just not care, disk is cheap and having multiple copies of the data may seem like a lot of unnecessary duplication, but it massively simplifies your architecture and you get some automatic benefits like easy scaling up to handle load (by just moving some of your users' DBs off to other servers).

Second is to have the shared data split into a different DB. This will occasionally limit things you can do in views (eg. no "Linked Documents") but this is not a big deal in many situations.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!