strongloop loopback id被发送给拥有该对象的用户

时间:2016-01-14 19:11:22

标签: loopbackjs strongloop

我有一个strongloop应用程序,我试图将一些数据发布到我的REST API,然后尝试从另一个用户检索它,但我没有得到" id"该记录对不拥有该对象的用户。如何访问生成的" id"来自不拥有该对象的用户。我的模型文件中没有ACL

我期望生成的唯一用户标识符与json响应一起返回,例如,如果我发出这样的请求 -

http://localhost:80/api/tuitions?access_token=qvpvtsbWOLZYydUDcbO0VP6YrlfHhbURHpkvPjnUyU9wRHpclAyJh44RKJ6VU36x

输出是 -

[
  {
    "area": [
      "901"
    ],
    "city": "9",
    "class": "9",
    "subjects": [
      "902"
    ],
    "userId": "5696915dec62196433db7950",
    "created": "2016-01-14T18:40:07.761Z",
    "updated": "2016-01-14T18:40:07.761Z",
    "identifier": "5697eb8767e585347755c23b"
  }
]

在我的loopback explorer中,我的loopback学费模型文件将标识符定义为 -

{
  "name": "tuition",
  "base": "PersistedModel",
  "strict": false,
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    // ...
    "identifier": {
      "type": "string",
      "id": true
    }
  },
  "validations": [],
  "relations": {},
  "acls": [],
  "methods": {}
}

但是当我在我的控制器中用我的角色应用程序发出相同的请求时使用类似 -

Tuition.find({
      filter: {
        order: 'created DESC'
      }
    }).$promise;

我明白了 -

[{"area":["901"],"city":"9","class":"9","subjects":["902"],"userId":"5696915dec62196433db7950","created":"2016-01-14T18:40:07.761Z","updated":"2016-01-14T18:40:07.761Z"}]

没有identifier

0 个答案:

没有答案