注册一个账号,发布文章,退出登录,注册另一个账号
- 发布:2024-04-23 11:16
- 更新:2024-06-11 16:02
- 阅读:401
产品分类: uniCloud/App
操作步骤:
预期结果:
看到第一个账号的文章
看到第一个账号的文章
实际结果:
报错Error: 权限校验未通过,参与权限校验的集合:[quanzi_article,uni-id-users]
报错Error: 权限校验未通过,参与权限校验的集合:[quanzi_article,uni-id-users]
bug描述:
用一个账号发文章,然后切换到其他账号的时候,看不到其他账号发的文章,
报错信息Error: 权限校验未通过,参与权限校验的集合:[quanzi_article,uni-id-users]
这两张表的权限都改成true也没用
quanzi_article.schema.json:
{
"bsonType": "object",
"required": ["user_id", "title"],
"permission": {
"read": true,
"create": "auth.uid != null",
"update": "doc.user_id == auth.uid || 'webmaster' in auth.role",
"delete": "doc.user_id == auth.uid"
},
"properties": {
"_id": {
"description": "存储文档 ID(用户 ID),系统自动生成"
},
"user_id": {
"bsonType": "string",
"description": "文章作者ID, 参考uni-id-users
表",
"foreignKey": "uni-id-users._id",
"defaultValue": {
"$env": "uid"
}
},
"title": {
"bsonType": "string",
"title": "标题",
"description": "标题",
"label": "标题",
"trim": "both"
},
"description": {
"bsonType": "string",
"title": "文章摘要",
"description": "文章摘要",
"label": "文章摘要",
"trim": "both"
},
"province": {
"bsonType": "string",
"title": "发布省份",
"description": "发布省份",
"label": "发布省份",
"trim": "both"
},
"content": {
"bsonType": "string",
"title": "文章内容",
"description": "文章内容",
"label": "文章内容",
"trim": "right"
},
"article_status": {
"bsonType": "int",
"title": "文章状态",
"description": "文章状态:0 草稿箱 1 已发布",
"defaultValue": 0,
"enum": [{
"value": 0,
"text": "草稿箱"
}, {
"value": 1,
"text": "已发布"
}]
},
"delState": {
"bsonType": "bool",
"title": "是否已被删除",
"description": "true是被删除了 false或者空代表正常",
"defaultValue": false
},
"view_count": {
"bsonType": "int",
"title": "阅读数量",
"description": "阅读数量",
"defaultValue": 55,
"permission": {
"write": false
}
},
"like_count": {
"bsonType": "int",
"description": "喜欢数、点赞数",
"defaultValue": 0,
"permission": {
"write": false
}
},
"comment_count": {
"bsonType": "int",
"description": "评论数量",
"defaultValue": 0,
"permission": {
"write": false
}
},
"last_comment_user_id": {
"bsonType": "string",
"description": "最后回复用户 id,参考uni-id-users
表",
"foreignKey": "uni-id-users._id"
},
"picurls": {
"bsonType": "array",
"title": "封面大图",
"description": "缩略图地址",
"label": "封面大图"
},
"publish_date": {
"bsonType": "timestamp",
"title": "发表时间",
"description": "发表时间",
"defaultValue": {
"$env": "now"
}
},
"publish_ip": {
"bsonType": "string",
"title": "发布文章时IP地址",
"description": "发表时 IP 地址",
"forceDefaultValue": {
"$env": "clientIP"
}
},
"last_modify_date": {
"bsonType": "timestamp",
"title": "最后修改时间",
"description": "最后修改时间",
"defaultValue": {
"$env": "now"
}
},
"last_modify_ip": {
"bsonType": "string",
"description": "最后修改时 IP 地址",
"forceDefaultValue": {
"$env": "clientIP"
}
}
},
"version": "0.0.1"
}
造件师 - 全栈开发在线接单:https://ask.dcloud.net.cn/article/41056
你的第一个账号是admin,第二个是其它角色吗,检查下schema,view_count等字段加了权限,也会导致失去读权限,去掉字段权限试试。
4***@qq.com (作者)
都是创建的普通用户,把那些字段权限删掉也不行
2024-04-23 11:59
4***@qq.com (作者)
试过数据库清空再初始化,也是不行
2024-04-23 11:59