feat: Add Parse Server option allowPublicExplain to allow Parse.Query.explain without master key (#9890)
This commit is contained in:
11
src/rest.js
11
src/rest.js
@@ -35,6 +35,17 @@ async function runFindTriggers(
|
||||
) {
|
||||
const { isGet } = options;
|
||||
|
||||
if (restOptions && restOptions.explain && !auth.isMaster) {
|
||||
const allowPublicExplain = config.databaseOptions?.allowPublicExplain ?? true;
|
||||
|
||||
if (!allowPublicExplain) {
|
||||
throw new Parse.Error(
|
||||
Parse.Error.INVALID_QUERY,
|
||||
'Using the explain query parameter requires the master key'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Run beforeFind trigger - may modify query or return objects directly
|
||||
const result = await triggers.maybeRunQueryTrigger(
|
||||
triggers.Types.beforeFind,
|
||||
|
||||
Reference in New Issue
Block a user