1***@qq.com
1***@qq.com
  • 发布:2022-05-03 14:06
  • 更新:2022-06-07 16:57
  • 阅读:439

客户端聚合操作,提示权限不够?

分类:uniCloud

代码片段:
问题描述:在客户端使用聚合操作,没有读取password,但是报错

Unhandled promise rejection Error: [uni-id-users.password.read]权限校验未通过  
    at vendor.js?t=wechat&s=1651545033498&v=d4a483e22002f276cf27b7c10772554e:23174  
    at VM5375 WAService.js:2  
    at n (VM5375 WAService.js:2)(env: Windows,mp,1.05.2204250; lib: 2.24.1)
									project = {  
										nickname: 1,  
										avatar_file:{  
											url: 1  
										},  
										mobile: 1,  
										location: 1,  
										username: 1,  
										email: 1  
									};  
									query = (()=>{  
										let required = {};  
										if (unrefresh) {  
											let gots = [];  
											list.forEach(x => gots.push(x._id));  
											console.log({  
												gots  
											});  
											required._id = _.nin(gots);  
										};  
										return _.and(  
											required,  
											_.or(  
												{  
													mobile: reg,  
												},  
												{  
													nickname: reg  
												},  
												{  
													username: reg  
												},  
												{  
													emil: reg  
												}  
											)  
										);  
									})();  
									console.log({query, project});  
									geoNear.query = query;  
									dbUIU.aggregate().geoNear(geoNear).project(project).sort({ creatTime: -1 }).limit(20).end().then(({result:{data:newList}})=>{  
										console.log({newList});  
									});
2022-05-03 14:06 负责人:无 分享
已邀请:
非专业键盘侠

非专业键盘侠

  • 表权限给够,包含联查的其他表
  • 字段是否设置了权限,权限给够
  • 字段设置了权限,是否通过条件语句或者field字段来适应这些规则

以上

mikeshi

mikeshi

我也遇到了相同的问题,感觉由于聚合操作本质上是要访问相关联的所有数据的,所以权限检查时过不了。另外,即使经过良好的权限设置,可以实现客户端聚合,实际操作时,实在难以判断到底是哪一个字段的访问造成了权限问题,基本不具备可操作性。

要回复问题请先登录注册