我正在基于StrongLoop API平台为我的客户构建一个事件管理Web应用程序,因此我需要限制对当前登录的用户(客户端)的数据的CRUD访问。LoopBack中的访问控制
我已经按照这些教程https://github.com/strongloop/loopback-faq-user-management,https://github.com/strongloop/loopback-example-access-control成功登录和注销,现在需要实现在AngularJS客户端上恢复正确的数据。
我已经建立了关系,在我的“事件”的模式如下:
"relations": {
"user": {
"type": "belongsTo",
"model": "User",
"foreignKey": "ownerId"
}
}
,并在内置的用户模型:
"relations": {
"events": {
"type": "hasMany",
"model": "event",
"foreignKey": "ownerId"
}
}
不知道在哪里/如何定义访问令牌登录后进行API调用。我是否还需要在$scope.events = Event.find();
上应用过滤器来检索ownerID: <currentUserId>
或ACL应该达到的记录?
任何帮助非常赞赏。