node.js - Strongloop - HasAndBelongsToMany always returns 401 -
i'm trying execute request:
put /api/cars/564d8e792583afef310affe3/categories/rel/suv-idcat
this works fine if i'm logged in administrator, if i'm logged in role, 401 response.
my car model has following acls:
... { "accesstype": "execute", "principaltype": "role", "principalid": "admin", "permission": "allow", "property": "__create__categories" }, { "accesstype": "execute", "principaltype": "role", "principalid": "admin", "permission": "allow", "property": "__updatebyid__categories" }, { "accesstype": "execute", "principaltype": "role", "principalid": "admin", "permission": "allow", "property": "__destroybyid__categories" } ...
now, if add same acl rules specific role:
{ "accesstype": "execute", "principaltype": "role", "principalid": "storeadmin", "permission": "allow", "property": "__create__categories" }, { "accesstype": "execute", "principaltype": "role", "principalid": "storeadmin", "permission": "allow", "property": "__updatebyid__categories" }, { "accesstype": "execute", "principaltype": "role", "principalid": "storeadmin", "permission": "allow", "property": "__destroybyid__categories" } ...
if tap endpoint logged in storeadmin user, 401 error response.
p.s. i've taken @ this: https://docs.strongloop.com/display/public/lb/accessing+related+models, there no "hasandbelongsto" relation
i'll answer myself. turns out hasmanyandbelongsto
relation, method names not same ones stated in documentation hasmany
relation. in fact, not documented.
by running app in debug mode: debug=loopback:security:*
found out real method name __link__categories
.
Comments
Post a Comment