loopbackjs - Cannot hide updateAttributes method -
loopbackjs - Cannot hide updateAttributes method -
related: strongloop: hiding method updateattributes(), accepted reply not solve problem.
i have followed started guide in order basic app setup. in app, model called pharmacy, , hide mutating functions (i.e. delete, update,create...) rest api.
i next instructions in documentation (http://docs.strongloop.com/display/public/lb/exposing+models+over+rest#exposingmodelsoverrest-hidingmethodsandrestendpoints). while can hide static functions fine, updateattributes method still beingness exposed no matter do.
i have placed hiding logic in common/models/pharmacy.js. placing in server/pharmacy.js indicated docs nothing, file not loaded.
the content of common/models/pharmacy.js is:
module.exports = function(pharmacy) { pharmacy.sharedclass.find('deletebyid', true).shared = false; pharmacy.sharedclass.find('updateattributes', false).shared = false; pharmacy.sharedclass.find('upsert', true).shared = false; pharmacy.sharedclass.find('create', true).shared = false; };
what doing wrong? in advance!
managed solve after helpful email devs. file should this:
module.exports = function(pharmacy) { pharmacy.disableremotemethod('deletebyid', true); pharmacy.disableremotemethod('updateattributes', false); pharmacy.disableremotemethod('updateall', true); pharmacy.disableremotemethod('upsert', true); pharmacy.disableremotemethod('create', true); };
loopbackjs
Comments
Post a Comment