Strongloop:ACL不起作用

时间:2016-07-22 09:35:38

标签: acl loopbackjs strongloop

我是Strongloop API的新手。总结我的问题: 我已将Mysql数据库连接到我的应用程序。我已经可以对扩展用户进行注册(POST),但我得到了:

“statusCode”:401,     “code”:“LOGIN_FAILED”,

....在LogIn(POST)上。探索其他方法,如findById,根据我的扩展用户的ACL定义,我发现ACL定义不能正常工作,因为findByID也不起作用。以下是我的扩展用户.json:

{
  "name": "UsersOficina",
  "plural": "UsersOficinas",
  "base": "User",
  "idInjection": true,
  "options": {
    "validateUpsert": true,
    "strict": true,
    "mysql": {
      "schema": "bo_oficina",
      "table": "usersOficina"
    }
  },
  "properties": {
    "fullName": {
      "type": "string"
    },
    "username": {
      "type": "string",
      "required": true
    },
    "entidades_id": {
      "type": "number",
      "required": true
    }
  },
  "validations": [],
  "relations": {},
  "inheritAcls": false,
  "acls": [
  {
    "principalType": "ROLE",
    "principal": "$everyone",
    "permission": "DENY"
  },
  {
    "principalType": "ROLE",
    "principalId": "$everyone",
    "permission": "ALLOW",
    "property": "create"
  },
  {
    "principalType": "ROLE",
    "principalId": "$owner",
    "permission": "ALLOW",
    "property": "deleteById"
  },
  {
    "principalType": "ROLE",
    "principalId": "$everyone",
    "permission": "ALLOW",
    "property": "login"
  },
  {
    "principalType": "ROLE",
    "principalId": "$everyone",
    "permission": "ALLOW",
    "property": "logout"
  },
  {
    "principalType": "ROLE",
    "principalId": "$owner",
    "permission": "ALLOW",
    "property": "findById"
  },
  {
    "principalType": "ROLE",
    "principalId": "$owner",
    "permission": "ALLOW",
    "property": "updateAttributes"
  },
  {
    "principalType": "ROLE",
    "principalId": "$everyone",
    "permission": "ALLOW",
    "property": "confirm"
  },
  {
    "principalType": "ROLE",
    "principalId": "$everyone",
    "permission": "ALLOW",
    "property": "resetPassword",
    "accessType": "EXECUTE"
  }
],
  "methods": {}
}

提前致谢! :)

EDIT [1]

使用DEBUG:loopback:user时的错误是“无效密码”。这是误导。密码只是数字2(“密码”:“2”)。

0 个答案:

没有答案