CouchDB范围内的只读访问权限 [英] CouchDB-wide read-only access rights

查看:115
本文介绍了CouchDB范围内的只读访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个CouchDB用户,该用户只能从任何数据库读取文档,而不能编写任何文档。就我而言,默认情况下不受支持(用户类型在此处)。

I need to create a CouchDB user which can only read documents from any database but can't write any of them. As far as I'm concerned, it is not what is supported by default (user types are described here).

正如Wiki所述,每个数据库都具有访问权限,所以我似乎并不是使用CouchDB的最佳方法。

As the wiki says, access rights are given per database, so it seems what I am trying to do is not the best way to use CouchDB.

无论如何,这样做是很棒的。

Anyway, it would be great to do that. Could you please give me some tips on how to implement that?

推荐答案

您需要在每个数据库中放置一个设计文档吗?想要执行此规则。设计文档必须具有验证功能 ,该功能可以检查用户是否有写权限的信息。

You will need to put a design doc in each database you want to enforce this rule. The design doc will have to have a 'validation function' that checks for something on the user that says whether they have write access or not.

此处是验证函数形成正式的 CouchDB书

甚至更好的是,此处是仅允许管理员使用的验证功能修改文档,并将普通用户限制为只读访问权限。 此处,您可以找到该功能的说明。

And even better, here is a validation function that only let admins modify a doc, and restrict regular users to read-only access. Here you can find an explanation of the function.

这篇关于CouchDB范围内的只读访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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