Loopback ACL on an individual property? -
it's possible set acl on method basis in loopback. instance can set access levels on find, update, delete
etc. there way filter out sensitive properties on models?
say want expose user model via rest, want properties protected acl. example maybe don't want expose phonenumber
or address
if query isn't made owner or administrator.
i see 2 different ways achieve this:
- extend basic user model own remote method findbyid , check user roles, exposing different data them.
- add "before" remote hook findbyid , check if user $owner - if call next, if not, call custom method returns data want expose public (check out https://docs.strongloop.com/display/public/lb/remote+hooks), not 100% sure works built in user methods thought
hope helps, greetz
Comments
Post a Comment