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 }