From 87f713598c6e7de3b05c3bc579744b269efe7965 Mon Sep 17 00:00:00 2001 From: chenruilong Date: Wed, 7 Jun 2023 20:48:36 +0800 Subject: [PATCH] update uni-cms-articles --- collection/uni-cms-articles/collection.json | 7 ++++--- collection/uni-cms-articles/schema.json | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/collection/uni-cms-articles/collection.json b/collection/uni-cms-articles/collection.json index ff735be..3bd3708 100644 --- a/collection/uni-cms-articles/collection.json +++ b/collection/uni-cms-articles/collection.json @@ -4,9 +4,9 @@ "required": ["user_id", "title", "content"], "permission": { "read": true, - "create": "auth.uid != null", - "update": "doc.user_id == auth.uid", - "delete": "doc.user_id == auth.uid" + "create": "'admin' in auth.role || 'CREATE_UNI_CMS_ARTICLE' in auth.permission", + "update": "'admin' in auth.role || 'UPDATE_UNI_CMS_ARTICLE' in auth.permission", + "delete": "'admin' in auth.role || 'DELETE_UNI_CMS_ARTICLE' in auth.permission" }, "properties": { "_id": { @@ -69,6 +69,7 @@ "bsonType": "int", "title": "阅读数量", "description": "阅读数量", + "defaultValue": 0, "permission": { "write": false } diff --git a/collection/uni-cms-articles/schema.json b/collection/uni-cms-articles/schema.json index 0571beb..03394bc 100644 --- a/collection/uni-cms-articles/schema.json +++ b/collection/uni-cms-articles/schema.json @@ -3,9 +3,9 @@ "required": ["user_id", "title", "content"], "permission": { "read": true, - "create": "auth.uid != null", - "update": "doc.user_id == auth.uid", - "delete": "doc.user_id == auth.uid" + "create": "'admin' in auth.role || 'CREATE_UNI_CMS_ARTICLE' in auth.permission", + "update": "'admin' in auth.role || 'UPDATE_UNI_CMS_ARTICLE' in auth.permission", + "delete": "'admin' in auth.role || 'DELETE_UNI_CMS_ARTICLE' in auth.permission" }, "properties": { "_id": { @@ -68,6 +68,7 @@ "bsonType": "int", "title": "阅读数量", "description": "阅读数量", + "defaultValue": 0, "permission": { "write": false }