Я не могу удалить или отредактировать объект, даже если я являюсь владельцем $ этого объекта в loopback.
Я следовал Документам https://loopback.io/doc/en/lb3/Define-access-controls.html, а также я получаю сообщение об ошибке.
Unhandled error for request DELETE /api/meetups/5c518a5d749b62092832ce21?access_token=ZPI056LqCx7GiTfln5QrelhynazxxsJcygq6MPpFVx0rRzXOOZ0vePMVte9YEduX: Error: Authorization Required
at D:\Mohammed\project\loopback-meetups\node_modules\loopback\lib\application.js:433:21
at D:\Mohammed\project\loopback-meetups\node_modules\loopback\lib\model.js:359:7
at D:\Mohammed\project\loopback-meetups\node_modules\loopback\common\models\acl.js:536:16
at D:\Mohammed\project\loopback-meetups\node_modules\async\dist\async.js:3888:9
at D:\Mohammed\project\loopback-meetups\node_modules\async\dist\async.js:473:16
at iteratorCallback (D:\Mohammed\project\loopback-meetups\node_modules\async\dist\async.js:1064:13)
at D:\Mohammed\project\loopback-meetups\node_modules\async\dist\async.js:969:16
at D:\Mohammed\project\loopback-meetups\node_modules\async\dist\async.js:3885:13
at D:\Mohammed\project\loopback-meetups\node_modules\loopback\common\models\acl.js:518:17
at D:\Mohammed\project\loopback-meetups\node_modules\loopback\common\models\role.js:447:21
at process._tickCallback (internal/process/next_tick.js:61:11)
Вот массив meetup.json
и acl
:
{
"name": "meetup",
"base": "PersistedModel",
"idInjection": true,
"options": { "validateUpsert": true },
"properties": {
"name": { "type": "string", "required": true },
"city": { "type": "string", "required": true }
},
"validations": [],
"relations": {},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
},
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
},
{
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW",
"property": "create"
},
{
"accessType": "WRITE",
"principalType": "ROLE",
"principalId": "$owner",
"permission": "ALLOW"
}
],
"methods": {}
}