1

我已经设置了sails 权限并且它运行良好。在尝试授予角色访问权限以读取标准时,我似乎只有一个问题。

我要实现的确切目标如下: - 角色 Public 中的用户应该能够读取/查看菜单模型中属性“状态”设置为“已批准”的任何菜单。

PermissionService.grant({action: 'read', model: 'Menu', role: 'public', criteria: [ { where:{ status: 'approved'}}]})

我认为我的语法有问题,但它似乎接受了它。运行命令后,我收到 500 错误消息...重新启动后,它显示 404。

有没有人见过这个,或者可以验证我的语法?

4

1 回答 1

0

尝试在语句之后添加 .then(console.log).catch(console.log) ,使其变为:

PermissionService.grant({action: 'read', model: 'Menu', role: 'public', criteria: [ { where:{ status: 'approved'}}]}).then(console.log).catch(console.log);

这将向您显示有关错误的更多信息并帮助您进行调试。也在这里发布错误!

于 2015-12-11T19:15:54.097 回答