mirror of
https://github.com/strapi/strapi.git
synced 2025-07-12 19:41:10 +00:00
Fixes #1247
This commit is contained in:
parent
0a9fff5a30
commit
c111aaba13
@ -51,4 +51,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -117,4 +117,4 @@
|
||||
"webpack-hot-middleware": "^2.18.2",
|
||||
"whatwg-fetch": "^2.0.3"
|
||||
}
|
||||
}
|
||||
}
|
@ -46,4 +46,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -50,4 +50,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -328,7 +328,7 @@ module.exports = {
|
||||
|
||||
return async (obj, options, context) => {
|
||||
// Hack to be able to handle permissions for each query.
|
||||
const ctx = Object.assign(context, {
|
||||
const ctx = Object.assign(_.clone(context), {
|
||||
request: Object.assign(_.clone(context.request), {
|
||||
graphql: null
|
||||
})
|
||||
@ -362,6 +362,7 @@ module.exports = {
|
||||
return values && values.toJSON ? values.toJSON() : values;
|
||||
}
|
||||
|
||||
|
||||
return resolver.call(null, obj, options, context);
|
||||
}
|
||||
|
||||
@ -560,7 +561,7 @@ module.exports = {
|
||||
|
||||
switch (association.nature) {
|
||||
case 'manyToMany': {
|
||||
const arrayOfIds = obj[association.alias].map(related => {
|
||||
const arrayOfIds = (obj[association.alias] || []).map(related => {
|
||||
return related[ref.primaryKey] || related;
|
||||
});
|
||||
|
||||
|
@ -48,4 +48,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -47,4 +47,4 @@
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -39,9 +39,11 @@ module.exports = async (ctx, next) => {
|
||||
}, []);
|
||||
|
||||
if (!permission) {
|
||||
ctx.forbidden();
|
||||
if (ctx.request.graphql === null) {
|
||||
return ctx.request.graphql = strapi.errors.forbidden();
|
||||
}
|
||||
|
||||
return ctx.request.graphql = ctx.body;
|
||||
ctx.forbidden();
|
||||
}
|
||||
|
||||
// Execute the policies.
|
||||
|
@ -54,4 +54,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ module.exports = strapi => {
|
||||
this.delegator = delegate(strapi.app.context, 'response');
|
||||
this.createResponses();
|
||||
|
||||
strapi.errors = Boom;
|
||||
strapi.app.use(async (ctx, next) => {
|
||||
try {
|
||||
// App logic.
|
||||
|
Loading…
x
Reference in New Issue
Block a user