ACL troubles with loopback.io

徘徊边缘 提交于 2019-12-06 07:51:41

It's not related to ACL's.

You want to change the business logic of the method. So the best practice is that you create a new method for getting shows owning by current user.

If you want to work your current owner ACl, you need to create a relation between user and show, and set ownerId in the show model.

  {
      "name": "Show",
      "base": "PersistedModel",
      "idInjection": true,
      "options": {
        "validateUpsert": true
      },
      "properties": {
        "title": {
          "type": "string",
          "required": true
        },
        "description": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
        "ownerId": {
          "type": "object"
        }

      },
      "validations": [],
      "relations": {
        "owner": {
          "type": "belongsTo",
          "model": "user",
          "foreignKey": "ownerId"
        },
....
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!