CouchDB / PouchDB部分同步,权限有限 [英] CouchDB / PouchDB partial syncs with limited rights

查看:122
本文介绍了CouchDB / PouchDB部分同步,权限有限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是偶然发现了CouchDB和PouchDB同步功能。通常,Web应用程序具有实现身份验证,权限和业务逻辑的应用程序服务器,从而可以限制用户对特定资源/记录的访问。这使我想到了几个问题:

I just stumbled across CouchDB and PouchDB sync features. Typically web applications have an application server implementing authentication, rights and business logic allowing to limit users access to specific resources/records. This brought up several questions in my mind:


  1. 是否有可能限制对沙发数据库中记录的访问。例如。超级管理员可以看到所有内容,部门管理员可以看到其部门的所有内容,而简单用户只能看到自己的记录,例如

  2. CouchDB + PouchDB是否只能执行部分同步。例如同步我负责的所有任务吗?

  3. 您是否将CouchDB用于用户身份验证和权限存储(针对上述用例)?看来无论如何我都觉得很奇怪,因为在我看来,每个人都可以访问用户数据库。


推荐答案


是否可以限制对沙发数据库中记录的访问。例如。超级管理员可以看到所有内容,部门管理员可以看到其部门的所有内容,而简单用户只能看到自己的记录,例如

Is it possible to limit access to records within couch db. Eg. a super-admin sees everything, a department-manager everything of his department and a simple user only his own records or e.g. tasks assigned to him?

不是。您不能只使用一个数据库,而只能使用CouchDB。
但是,有几种方法可以实现此目的,例如:

Nope. You can't do this with a single DB and using only CouchDB. But there are a few ways you can realize this, for instance:


  • 每个项目/用户组/用户使用数据库。在大多数情况下,这可能是首选方法。在CouchDB中创建数据库很容易。最好同步

  • 创建一个智能代理,该代理使用用户凭据包装所有文档并过滤所有结果

  • 每次加密文档用户基础

  • 使用validate_doc_read和validate_doc_update函数

  • use a database per project/user group/user. This would probably in most cases be the preferred method. Creating databases is easy in CouchDB. It would also be best for syncing
  • create a smart proxy that wraps all documents with the user credentials and filters all results
  • encrypt documents on a per user basis
  • use validate_doc_read and validate_doc_update functions

此处提供更多信息: https://wiki.apache.org/couchdb/PerDocumentAuthorization

这篇关于CouchDB / PouchDB部分同步,权限有限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆