Skip to content

Commit 97d6e9d

Browse files
committed
Merge pull request #695 from Marco129/client-class-creation
Allow create system class even allowClientClassCreation option is false
2 parents db9b72b + c359d0f commit 97d6e9d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ The client keys used with Parse are no longer necessary with Parse Server. If yo
126126
* `databaseAdapter` (unfinished) - The backing store can be changed by creating an adapter class (see `DatabaseAdapter.js`)
127127
* `loggerAdapter` - The default behavior/transport (File) can be changed by creating an adapter class (see [`LoggerAdapter.js`](https://github.com/ParsePlatform/parse-server/blob/master/src/Adapters/Logger/LoggerAdapter.js))
128128
* `enableAnonymousUsers` - Defaults to true. Set to false to disable anonymous users.
129+
* `allowClientClassCreation` - Defaults to true. Set to false to disable client class creation.
129130
* `oauth` - Used to configure support for [3rd party authentication](https://github.com/ParsePlatform/parse-server/wiki/Parse-Server-Guide#oauth).
130131
* `maxUploadSize` - Defaults to 20mb. Max file size for uploads
131132

src/RestQuery.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ RestQuery.prototype.redirectClassNameForKey = function() {
165165

166166
// Validates this operation against the allowClientClassCreation config.
167167
RestQuery.prototype.validateClientClassCreation = function() {
168-
if (this.config.allowClientClassCreation === false && !this.auth.isMaster) {
168+
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
169+
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
170+
&& sysClass.indexOf(this.className) === -1) {
169171
return this.config.database.loadSchema().then((schema) => {
170172
return schema.hasClass(this.className)
171173
}).then((hasClass) => {

src/RestWrite.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ RestWrite.prototype.getUserAndRoleACL = function() {
109109

110110
// Validates this operation against the allowClientClassCreation config.
111111
RestWrite.prototype.validateClientClassCreation = function() {
112-
if (this.config.allowClientClassCreation === false && !this.auth.isMaster) {
112+
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
113+
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
114+
&& sysClass.indexOf(this.className) === -1) {
113115
return this.config.database.loadSchema().then((schema) => {
114116
return schema.hasClass(this.className)
115117
}).then((hasClass) => {

0 commit comments

Comments
 (0)