- 怎么样才能做到数据库表所有数据查询的权限控制?
以微信官方文档中的数据库权限管理中的示例:商品订单管理为例。 假如我想要实现查看我当前所有管理的和创建的商店列表,应该如何来配置这个自定义规则。 我自己的理解和实践,只能把 read 设置为 true: { "read": true } 查询当前商店的商品和订单的时候,我可以传入 shopId,在规则中使用 get() 函数来查询到该商店的创建者和管理员。 但是当我想要查询我的商店列表的时候,好像除了把 read 设置为 true 外再没有其他办法了。 附上一些自己找到的文档: https://docs.cloudbase.net/database/security-rules#%E9%85%8D%E7%BD%AEhttps://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/guide/database/security-rules.html#%E7%AE%80%E4%BB%8B
01-25 - 到底如何才能根据数据库中的sharedUsers来判定查询权限。
https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/guide/database/security-rules.html。 目前test数据库中自定义安全规则如下: { "read": "auth.openid in get(`database.test.${doc._id}`).sharedUsers", "write": false, } 为什么我的 sharedUser 中明明包括了当前用户的 openid 在查询test库中所有 sharedUsers中包括了当前用户的openid的记录时会一直提示:database permission denied。 查询命令如下: const result = await db .collection("test") .where({ sharedUsers: openid, // _openid: openid, }).get(); 如果我把 read 设置为 true,则可以查询出来。 ## 更新 发现即使设置为创建者都是没有权限的: { "read": "doc._openid == auth.openid", "write": "doc._openid == auth.openid" } 对此只想说mmp
01-24