Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function accessibleFieldsBy(ability, action = 'read') {
if (!fieldsFrom) {
const ALL_FIELDS = options.only ? wrapArray(options.only) : fieldsOf(schema, options);
fieldsFrom = rule => rule.fields || ALL_FIELDS;
}
const subject = typeof this === 'function' ? this.modelName : this;
return permittedFieldsOf(ability, action, subject, { fieldsFrom });
}
const permittedFieldsBy = deprecate('permittedFieldsBy', {