rename exports

This commit is contained in:
Ben Irvin 2023-08-22 10:33:23 +02:00
parent 66e0202942
commit ff32681b9a
3 changed files with 10 additions and 10 deletions

View File

@ -45,7 +45,7 @@ const STATIC_FIELDS = [ID_ATTRIBUTE];
module.exports = ({ action, ability, model }) => { module.exports = ({ action, ability, model }) => {
const schema = strapi.getModel(model); const schema = strapi.getModel(model);
const { allowedFields } = sanitize.visitors; const { removeDisallowedFields } = sanitize.visitors;
const { traverseQueryFilters, traverseQuerySort, traverseQueryPopulate, traverseQueryFields } = const { traverseQueryFilters, traverseQuerySort, traverseQueryPopulate, traverseQueryFields } =
traverse.traversals; traverse.traversals;
@ -56,7 +56,7 @@ module.exports = ({ action, ability, model }) => {
const permittedFields = fields.shouldIncludeAll ? null : getQueryFields(fields.permitted); const permittedFields = fields.shouldIncludeAll ? null : getQueryFields(fields.permitted);
const sanitizeFilters = pipeAsync( const sanitizeFilters = pipeAsync(
traverseQueryFilters(allowedFields(permittedFields), { schema }), traverseQueryFilters(removeDisallowedFields(permittedFields), { schema }),
traverseQueryFilters(omitDisallowedAdminUserFields, { schema }), traverseQueryFilters(omitDisallowedAdminUserFields, { schema }),
traverseQueryFilters(removePassword, { schema }), traverseQueryFilters(removePassword, { schema }),
traverseQueryFilters( traverseQueryFilters(
@ -70,7 +70,7 @@ module.exports = ({ action, ability, model }) => {
); );
const sanitizeSort = pipeAsync( const sanitizeSort = pipeAsync(
traverseQuerySort(allowedFields(permittedFields), { schema }), traverseQuerySort(removeDisallowedFields(permittedFields), { schema }),
traverseQuerySort(omitDisallowedAdminUserFields, { schema }), traverseQuerySort(omitDisallowedAdminUserFields, { schema }),
traverseQuerySort(removePassword, { schema }), traverseQuerySort(removePassword, { schema }),
traverseQuerySort( traverseQuerySort(
@ -84,13 +84,13 @@ module.exports = ({ action, ability, model }) => {
); );
const sanitizePopulate = pipeAsync( const sanitizePopulate = pipeAsync(
traverseQueryPopulate(allowedFields(permittedFields), { schema }), traverseQueryPopulate(removeDisallowedFields(permittedFields), { schema }),
traverseQueryPopulate(omitDisallowedAdminUserFields, { schema }), traverseQueryPopulate(omitDisallowedAdminUserFields, { schema }),
traverseQueryPopulate(removePassword, { schema }) traverseQueryPopulate(removePassword, { schema })
); );
const sanitizeFields = pipeAsync( const sanitizeFields = pipeAsync(
traverseQueryFields(allowedFields(permittedFields), { schema }), traverseQueryFields(removeDisallowedFields(permittedFields), { schema }),
traverseQueryFields(removePassword, { schema }) traverseQueryFields(removePassword, { schema })
); );
@ -128,7 +128,7 @@ module.exports = ({ action, ability, model }) => {
// Remove unallowed fields from admin::user relations // Remove unallowed fields from admin::user relations
traverseEntity(pickAllowedAdminUserFields, { schema }), traverseEntity(pickAllowedAdminUserFields, { schema }),
// Remove not allowed fields (RBAC) // Remove not allowed fields (RBAC)
traverseEntity(allowedFields(permittedFields), { schema }), traverseEntity(removeDisallowedFields(permittedFields), { schema }),
// Remove all fields of type 'password' // Remove all fields of type 'password'
sanitize.sanitizers.sanitizePasswords(schema) sanitize.sanitizers.sanitizePasswords(schema)
); );
@ -143,7 +143,7 @@ module.exports = ({ action, ability, model }) => {
// Remove fields hidden from the admin // Remove fields hidden from the admin
traverseEntity(omitHiddenFields, { schema }), traverseEntity(omitHiddenFields, { schema }),
// Remove not allowed fields (RBAC) // Remove not allowed fields (RBAC)
traverseEntity(allowedFields(permittedFields), { schema }), traverseEntity(removeDisallowedFields(permittedFields), { schema }),
// Remove roles from createdBy & updateBy fields // Remove roles from createdBy & updateBy fields
omitCreatorRoles omitCreatorRoles
); );

View File

@ -37,7 +37,7 @@ const createContentAPISanitizers = () => {
const transforms = [ const transforms = [
// Remove non writable attributes // Remove non writable attributes
traverseEntity(visitors.restrictedFields(nonWritableAttributes), { schema }), traverseEntity(visitors.removeRestrictedFields(nonWritableAttributes), { schema }),
]; ];
if (auth) { if (auth) {

View File

@ -3,5 +3,5 @@ export { default as removePrivate } from './remove-private';
export { default as removeRestrictedRelations } from './remove-restricted-relations'; export { default as removeRestrictedRelations } from './remove-restricted-relations';
export { default as removeMorphToRelations } from './remove-morph-to-relations'; export { default as removeMorphToRelations } from './remove-morph-to-relations';
export { default as removeDynamicZones } from './remove-dynamic-zones'; export { default as removeDynamicZones } from './remove-dynamic-zones';
export { default as allowedFields } from './remove-disallowed-fields'; export { default as removeDisallowedFields } from './remove-disallowed-fields';
export { default as restrictedFields } from './remove-restricted-fields'; export { default as removeRestrictedFields } from './remove-restricted-fields';