loopback.io 型号、acl principalId、$owner
loopback.io model, acl principalId, $owner
我需要将模型中的数据访问限制为仅创建它的环回用户。
我在文档中看到了这个:
http://loopback.io/doc/en/lb2/Model-definition-JSON-file.html#acls
$owner - Owner of the object
这是否意味着创建该对象的登录用户?
当模型运行创建时,loopback.io 是否将当前登录用户的用户 ID 存储在它自己的 ACL 中?
或者我是否需要做这样的事情,即在我的模型上创建与用户模型相关的新属性:
知道了:
http://loopback.io/doc/en/lb2/Defining-and-using-roles.html#dynamic-roles
To qualify a $owner, the target model needs to have a belongsTo
relation to the User model (or a model extends from User) and property
matching the foreign key of the target model instance. The check for
$owner is only performed for a remote method that has ‘:id’ on the
path, for example, GET /api/users/:id.
我需要将模型中的数据访问限制为仅创建它的环回用户。
我在文档中看到了这个:
http://loopback.io/doc/en/lb2/Model-definition-JSON-file.html#acls
$owner - Owner of the object
这是否意味着创建该对象的登录用户?
当模型运行创建时,loopback.io 是否将当前登录用户的用户 ID 存储在它自己的 ACL 中?
或者我是否需要做这样的事情,即在我的模型上创建与用户模型相关的新属性:
知道了:
http://loopback.io/doc/en/lb2/Defining-and-using-roles.html#dynamic-roles
To qualify a $owner, the target model needs to have a belongsTo relation to the User model (or a model extends from User) and property matching the foreign key of the target model instance. The check for $owner is only performed for a remote method that has ‘:id’ on the path, for example, GET /api/users/:id.