1
我有這種模式在customers.json,訪問控制列表:如何在Loopback 3中定義管理角色?
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "admin",
"permission": "ALLOW",
"through": "RoleMapping"
}
]
,我已經環回用戶該用戶模型庫:
{
"name": "userModel",
"base": "User",
...
}
"relations": {
"roles": {
"type": "hasMany",
"model": "Role",
"foreignKey": "principalId"
}
},
我在http://localhost:3000/explorer在RoleMapping定義:
{
"id": "58b82f1dbd7b9f1a601646cf",
"principalType": "USER",
"principalId": "58b82ec9bd7b9f1a601646ce",
"roleId": "5570fb69a1227c8c039293da"
}
但是當我嘗試展示客戶時,我總是得到401未授權的錯誤。 如果有人能幫助我,我會很高興。
謝謝,它的工作 – oded