loopback-setup-remote-methods-mixin
Version:
Mixin for Loopback, to easily disable remote methods and setup new ones from the model configuration file.
22 lines (17 loc) • 456 B
JavaScript
;
module.exports = {
getAuthorizedAclMethods,
};
function getAuthorizedAclMethods(Model) {
let authorizedMethods = [];
let acls = Model.settings.acls || [];
acls.forEach((acl) => {
if (acl.permission === 'ALLOW' && acl.property) {
if (!Array.isArray(acl.property)) {
acl.property = [acl.property];
}
authorizedMethods = authorizedMethods.concat(acl.property);
}
});
return authorizedMethods;
}