Don't run shadowCRUD related operations if it's disabled

This commit is contained in:
Convly 2021-09-22 18:17:51 +02:00
parent c31478b01d
commit a303b0e5c4
2 changed files with 14 additions and 1 deletions

View File

@ -11,9 +11,15 @@ const DELETE_FILE_MUTATION_NAME = 'removeFile';
const FILE_INFO_INPUT_TYPE_NAME = 'FileInfoInput';
module.exports = ({ strapi }) => {
const { service: getGraphQLService } = strapi.plugin('graphql');
const { service: getGraphQLService, config: graphQLConfig } = strapi.plugin('graphql');
const { service: getUploadService } = strapi.plugin('upload');
const isShadowCRUDEnabled = graphQLConfig('shadowCRUD', true);
if (!isShadowCRUDEnabled) {
return;
}
const { getTypeName, getEntityResponseName } = getGraphQLService('utils').naming;
const { toEntityResponse } = getGraphQLService('format').returnTypes;

View File

@ -5,8 +5,15 @@ const getQueries = require('./queries');
const getMutations = require('./mutations');
module.exports = ({ strapi }) => {
const { config: graphQLConfig } = strapi.plugin('graphql');
const extensionService = strapi.plugin('graphql').service('extension');
const isShadowCRUDEnabled = graphQLConfig('shadowCRUD', true);
if (!isShadowCRUDEnabled) {
return;
}
// Disable Permissions queries & mutations but allow the
// type to be used/selected in filters or nested resolvers
extensionService