我已使用分配的条件创建了权限,但它始终会导致 404 未找到
,表明没有允许的记录。从日志的输出中可以看出,criteria
是 { group: 1 }
,并且有一条记录 group = 1
,因此应该返回一条记录,因为您可以看到 permissed.lenth
等于 0
。有谁熟悉sails-permissions能否告知这是否正确?
日志输出
silly: PermissionPolicy: 1 permissions grant read on Issue for johnsmith
info: responsePolicy
silly: data [ { items:
[ { owner: 1,
group: 1,
id: 1,
title: 'An important issue',
open: true,
createdAt: '2015-08-24T18:17:32.580Z',
updatedAt: '2015-08-24T18:17:32.586Z' },
{ owner: 3,
group: 2,
id: 2,
title: 'An issue belonging to another group',
open: true,
createdAt: '2015-08-24T18:17:32.582Z',
updatedAt: '2015-08-24T18:17:32.582Z' } ],
_pagination: { current: 1, limit: 30, items: 2, pages: 1 } } ]
silly: options undefined
silly: criteria! [ { where: { group: 1 },
permission: 45,
createdAt: '2015-08-24T18:10:36.891Z',
updatedAt: '2015-08-24T18:10:36.891Z',
id: 1 } ]
silly: permitted.length === 0
最佳答案
这是由自定义 find
蓝图重新格式化数据结构引起的,以添加分页元 { items: [], _pagination: {...}}
。这与 sails-permissions
对查找蓝图的期望相冲突,查找蓝图是一个数组 []
。
关于node.js - 标准许可与 sails 许可,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32198437/