diff --git a/collection/opendb-mall-categories/collection.json b/collection/opendb-mall-categories/collection.json index b4e5efa..6c72e17 100644 --- a/collection/opendb-mall-categories/collection.json +++ b/collection/opendb-mall-categories/collection.json @@ -2,6 +2,12 @@ "schema": { "bsonType": "object", "required": ["name"], + "permission": { + ".read": true, + ".create": false, + ".update": false, + ".delete": false + }, "properties": { "_id": { "description": "存储文档 ID(文章 ID),系统自动生成" diff --git a/collection/opendb-mall-comments/collection.json b/collection/opendb-mall-comments/collection.json index a3ebfa3..bc31000 100644 --- a/collection/opendb-mall-comments/collection.json +++ b/collection/opendb-mall-comments/collection.json @@ -2,6 +2,12 @@ "schema": { "bsonType": "object", "required": ["goods_id", "user_id", "content"], + "permission": { + ".read": true, + ".create": "auth.uid != null", + ".update": "doc.user_id == auth.uid", + ".delete": "doc.user_id == auth.uid" + }, "properties": { "_id": { "description": "存储文档 ID(文章 ID),系统自动生成" diff --git a/collection/opendb-news-comments/collection.json b/collection/opendb-news-comments/collection.json index 4401d46..64c942d 100644 --- a/collection/opendb-news-comments/collection.json +++ b/collection/opendb-news-comments/collection.json @@ -18,7 +18,10 @@ }, "user_id": { "bsonType": "string", - "description": "评论者ID,参考`uni-id-users` 表" + "description": "评论者ID,参考`uni-id-users` 表", + "forceDefaultValue": { + "$env": "uid" + } }, "comment_content": { "bsonType": "string", diff --git a/collection/opendb-search-hot/collection.json b/collection/opendb-search-hot/collection.json index 8c06238..affbce6 100644 --- a/collection/opendb-search-hot/collection.json +++ b/collection/opendb-search-hot/collection.json @@ -2,6 +2,12 @@ "schema": { "bsonType": "object", "required": ["content", "count"], + "permission": { + ".read": true, + ".create": false, + ".update": false, + ".delete": false + }, "properties": { "_id": { "description": "ID,系统自动生成" diff --git a/collection/opendb-search-log/collection.json b/collection/opendb-search-log/collection.json index e46deba..ed86473 100644 --- a/collection/opendb-search-log/collection.json +++ b/collection/opendb-search-log/collection.json @@ -1,7 +1,13 @@ { "schema": { "bsonType": "object", - "required": ["user_id", "content"], + "required": ["content"], + "permission": { + ".read": false, + ".create": false, + ".update": false, + ".delete": false + }, "properties": { "_id": { "description": "ID,系统自动生成"