【发布时间】:2016-01-22 19:57:12
【问题描述】:
我正在使用 ACL 规则来阻止所有用户的所有类型的访问。它适用于 GET 访问,但不适用于 POST 访问。
知道可能出了什么问题吗?
这里是代码和示例结果:
/common/models/client.json
{
"name": "client",
"plural": "clients",
"base": "User",
"idInjection": true,
"properties": {},
"validations": [],
"relations": {},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY"
}
],
"methods": {}
}
GET 访问错误(按预期工作,已被阻止):
卷曲
curl -X GET --header "Accept: application/json" "http://localserver:8080/api/quants"
回复
{
"error": {
"name": "Error",
"status": 401,
"message": "Authorization Required",
"statusCode": 401,
"code": "AUTHORIZATION_REQUIRED",
"stack": "Error: Authorization Required\n at ...
}
}
POST 错误,访问未被阻止。不工作。
卷曲:
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{
\"email\": \"test@email.com\",
\"password\": \"abcd1234\"
}
" "http://localserver:8080/api/clients"
回复
{
"email": "test@email.com",
"id": "46b258078da5dtg1ji5809ww"
}
【问题讨论】:
标签: loopbackjs strongloop