我正在 mysql 数据库中维护我的 ACL 数据(我的模型的 ACL 列表)。它与我提到的远程方法(属性列)的角色配合得很好。
对于某些模型,我必须拒绝模型的所有远程方法的访问。对于这些用例,我应该在表中该模型的属性列中提及什么?
通常情况下,如果我们在 json 中维护模型的 ACL,并且需要拒绝该特定模型的所有远程方法访问,那么我们不需要提及“属性”值。它将拒绝所有远程方法的访问。
拒绝所有远程方法:
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$unauthenticated",
"permission": "DENY"
}
拒绝特定的远程方法“getDistrict”:
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$unauthenticated",
"permission": "DENY",
"property": "getDistrict"
}
但是,对于数据库表,如果我需要拒绝访问模型的所有远程方法,我必须在属性列中提及什么? ('ALL'
或 '*'
或 留空
?)
另外,如果我有什么错误的地方,请纠正我。
谢谢
最佳答案
https://loopback.io/doc/en/lb3/Controlling-data-access.html#user-access-types
For other methods, the default access type is EXECUTE;
for example, a custom method maps to the EXECUTE access type.
因此拒绝使用所有远程方法
{
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
}
编辑:要真正回答这个问题,您不需要存储任何内容,因为 accessType: "EXECUTE"
涵盖了所有自定义远程方法。
acl source 中的这一行建议他们不对属性进行通配符匹配
var isMatchingMethodName = props[i] === 'property' &&
req.methodNames.indexOf(ruleValue) !== -1;
关于mysql - 环回 - ACL - 'property' DB 表中的默认值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49406722/