2
我目前正在評估loopback.io以開發新項目的API部分,並且在設置正確的ACL條目時遇到問題。訪問控制列表問題loopback.io
我希望完成的是一個授權令牌,GET端點應該只返回用戶擁有的對象。例如,對/ Shows?access_token = xxxxxx的請求應僅返回用戶擁有的對象。
下面是我的shows.json文件,我的用戶模型名爲Podcaster。任何幫助,將不勝感激。
{
"name": "Show",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"title": {
"type": "string",
"required": true
},
"description": {
"type": "string"
}
},
"validations": [],
"relations": {
"episodes": {
"type": "hasMany",
"model": "Episode",
"foreignKey": ""
},
"podcaster": {
"type": "belongsTo",
"model": "Podcaster",
"foreignKey": ""
}
},
"acls": [
{
"accessType": "WRITE",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW",
"property": "create"
},
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$owner",
"permission": "ALLOW"
},
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
}
],
"methods": {}
}