add permission

This commit is contained in:
崔红保 2020-10-27 18:21:58 +08:00
parent 2c211d4c96
commit fdac3feb1d
5 changed files with 29 additions and 2 deletions

View File

@ -2,6 +2,12 @@
"schema": { "schema": {
"bsonType": "object", "bsonType": "object",
"required": ["name"], "required": ["name"],
"permission": {
".read": true,
".create": false,
".update": false,
".delete": false
},
"properties": { "properties": {
"_id": { "_id": {
"description": "存储文档 ID文章 ID系统自动生成" "description": "存储文档 ID文章 ID系统自动生成"

View File

@ -2,6 +2,12 @@
"schema": { "schema": {
"bsonType": "object", "bsonType": "object",
"required": ["goods_id", "user_id", "content"], "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": { "properties": {
"_id": { "_id": {
"description": "存储文档 ID文章 ID系统自动生成" "description": "存储文档 ID文章 ID系统自动生成"

View File

@ -18,7 +18,10 @@
}, },
"user_id": { "user_id": {
"bsonType": "string", "bsonType": "string",
"description": "评论者ID参考`uni-id-users` 表" "description": "评论者ID参考`uni-id-users` 表",
"forceDefaultValue": {
"$env": "uid"
}
}, },
"comment_content": { "comment_content": {
"bsonType": "string", "bsonType": "string",

View File

@ -2,6 +2,12 @@
"schema": { "schema": {
"bsonType": "object", "bsonType": "object",
"required": ["content", "count"], "required": ["content", "count"],
"permission": {
".read": true,
".create": false,
".update": false,
".delete": false
},
"properties": { "properties": {
"_id": { "_id": {
"description": "ID系统自动生成" "description": "ID系统自动生成"

View File

@ -1,7 +1,13 @@
{ {
"schema": { "schema": {
"bsonType": "object", "bsonType": "object",
"required": ["user_id", "content"], "required": ["content"],
"permission": {
".read": false,
".create": false,
".update": false,
".delete": false
},
"properties": { "properties": {
"_id": { "_id": {
"description": "ID系统自动生成" "description": "ID系统自动生成"