fix purge command issue affecting readonly masterKey (#4619) (#4621)

This commit is contained in:
AreyouHappy
2018-03-11 00:07:31 +09:00
committed by Florent Vilmart
parent 673039fc5a
commit d768211ab9

View File

@@ -4,6 +4,9 @@ import * as middleware from '../middlewares';
export class PurgeRouter extends PromiseRouter {
handlePurge(req) {
if (req.auth.isReadOnly) {
throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, 'read-only masterKey isn\'t allowed to purge a schema.');
}
return req.config.database.purgeCollection(req.params.className)
.then(() => {
var cacheAdapter = req.config.cacheController;