Centralizes list of system classes into Schema

This commit is contained in:
Florent Vilmart
2016-03-12 13:40:59 -05:00
parent 49531e7efe
commit 308fe1498a
3 changed files with 39 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
// An object that encapsulates everything we need to run a 'find'
// operation, encoded in the REST API format.
var Schema = require('./Schema');
var Parse = require('parse/node').Parse;
import { default as FilesController } from './Controllers/FilesController';
@@ -171,7 +172,7 @@ RestQuery.prototype.redirectClassNameForKey = function() {
// Validates this operation against the allowClientClassCreation config.
RestQuery.prototype.validateClientClassCreation = function() {
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
let sysClass = Schema.systemClasses;
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
&& sysClass.indexOf(this.className) === -1) {
return this.config.database.collectionExists(this.className).then((hasClass) => {
@@ -423,7 +424,7 @@ RestQuery.prototype.handleInclude = function() {
this.include = this.include.slice(1);
return this.handleInclude();
}
return pathResponse;
};