Skip to content

Commit 29624e0

Browse files
authored
feat: Deprecation DEPPS5: Config option allowClientClassCreation defaults to false (#8849)
BREAKING CHANGE: The Parse Server option `allowClientClassCreation` defaults to `false`.
1 parent fe1e4d9 commit 29624e0

File tree

8 files changed

+43
-7
lines changed

8 files changed

+43
-7
lines changed

Diff for: DEPRECATIONS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The following is a list of deprecations, according to the [Deprecation Policy](h
88
| DEPPS2 | Config option `directAccess` defaults to `true` | [#6636](https://github.com/parse-community/parse-server/pull/6636) | 5.0.0 (2022) | 6.0.0 (2023) | removed | - |
99
| DEPPS3 | Config option `enforcePrivateUsers` defaults to `true` | [#7319](https://github.com/parse-community/parse-server/pull/7319) | 5.0.0 (2022) | 6.0.0 (2023) | removed | - |
1010
| DEPPS4 | Remove convenience method for http request `Parse.Cloud.httpRequest` | [#7589](https://github.com/parse-community/parse-server/pull/7589) | 5.0.0 (2022) | 6.0.0 (2023) | removed | - |
11-
| DEPPS5 | Config option `allowClientClassCreation` defaults to `false` | [#7925](https://github.com/parse-community/parse-server/pull/7925) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
11+
| DEPPS5 | Config option `allowClientClassCreation` defaults to `false` | [#7925](https://github.com/parse-community/parse-server/pull/7925) | 5.3.0 (2022) | 7.0.0 (2024) | removed | - |
1212
| DEPPS6 | Auth providers disabled by default | [#7953](https://github.com/parse-community/parse-server/pull/7953) | 5.3.0 (2022) | 7.0.0 (2024) | removed | - |
1313
| DEPPS7 | Remove file trigger syntax `Parse.Cloud.beforeSaveFile((request) => {})` | [#7966](https://github.com/parse-community/parse-server/pull/7966) | 5.3.0 (2022) | 7.0.0 (2024) | removed | - |
1414
| DEPPS8 | Login with expired 3rd party authentication token defaults to `false` | [#7079](https://github.com/parse-community/parse-server/pull/7079) | 5.3.0 (2022) | 7.0.0 (2024) | removed | - |

Diff for: spec/ParseUser.spec.js

+28
Original file line numberDiff line numberDiff line change
@@ -4402,3 +4402,31 @@ describe('login as other user', () => {
44024402
done();
44034403
});
44044404
});
4405+
4406+
describe('allowClientClassCreation option', () => {
4407+
it('should enforce boolean values', async () => {
4408+
const options = [[], 'a', '', 0, 1, {}, 'true', 'false'];
4409+
for (const option of options) {
4410+
await expectAsync(reconfigureServer({ allowClientClassCreation: option })).toBeRejected();
4411+
}
4412+
});
4413+
4414+
it('should accept true value', async () => {
4415+
await reconfigureServer({ allowClientClassCreation: true });
4416+
expect(Config.get(Parse.applicationId).allowClientClassCreation).toBe(true);
4417+
});
4418+
4419+
it('should accept false value', async () => {
4420+
await reconfigureServer({ allowClientClassCreation: false });
4421+
expect(Config.get(Parse.applicationId).allowClientClassCreation).toBe(false);
4422+
});
4423+
4424+
it('should default false', async () => {
4425+
// remove predefined allowClientClassCreation:true on global defaultConfiguration
4426+
delete defaultConfiguration.allowClientClassCreation;
4427+
await reconfigureServer(defaultConfiguration);
4428+
expect(Config.get(Parse.applicationId).allowClientClassCreation).toBe(false);
4429+
// Need to set it back to true to avoid other test fails
4430+
defaultConfiguration.allowClientClassCreation = true;
4431+
});
4432+
});

Diff for: spec/helper.js

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ const defaultConfiguration = {
129129
},
130130
shortLivedAuth: mockShortLivedAuth(),
131131
},
132+
allowClientClassCreation: true,
132133
};
133134

134135
if (process.env.PARSE_SERVER_TEST_CACHE === 'redis') {

Diff for: src/Config.js

+8
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export class Config {
9090
rateLimit,
9191
databaseOptions,
9292
extendSessionOnUse,
93+
allowClientClassCreation,
9394
}) {
9495
if (masterKey === readOnlyMasterKey) {
9596
throw new Error('masterKey and readOnlyMasterKey should be different');
@@ -132,6 +133,7 @@ export class Config {
132133
this.validateRateLimit(rateLimit);
133134
this.validateLogLevels(logLevels);
134135
this.validateDatabaseOptions(databaseOptions);
136+
this.validateAllowClientClassCreation(allowClientClassCreation);
135137
}
136138

137139
static validateControllers({
@@ -174,6 +176,12 @@ export class Config {
174176
}
175177
}
176178

179+
static validateAllowClientClassCreation(allowClientClassCreation) {
180+
if (typeof allowClientClassCreation !== 'boolean') {
181+
throw 'Parse Server option allowClientClassCreation must be a boolean.';
182+
}
183+
}
184+
177185
static validateSecurityOptions(security) {
178186
if (Object.prototype.toString.call(security) !== '[object Object]') {
179187
throw 'Parse Server option security must be an object.';

Diff for: src/Deprecator/Deprecations.js

-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@
1616
* If there are no deprecations, this must return an empty array.
1717
*/
1818
module.exports = [
19-
{ optionKey: 'allowClientClassCreation', changeNewDefault: 'false' },
2019
{ optionKey: 'encodeParseObjectInCloudFunction', changeNewDefault: 'true' },
2120
];

Diff for: src/Options/Definitions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ module.exports.ParseServerOptions = {
5757
},
5858
allowClientClassCreation: {
5959
env: 'PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION',
60-
help: 'Enable (or disable) client class creation, defaults to true',
60+
help: 'Enable (or disable) client class creation, defaults to false',
6161
action: parsers.booleanParser,
62-
default: true,
62+
default: false,
6363
},
6464
allowCustomObjectId: {
6565
env: 'PARSE_SERVER_ALLOW_CUSTOM_OBJECT_ID',

Diff for: src/Options/docs.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/Options/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ export interface ParseServerOptions {
148148
:ENV: PARSE_SERVER_ENABLE_ANON_USERS
149149
:DEFAULT: true */
150150
enableAnonymousUsers: ?boolean;
151-
/* Enable (or disable) client class creation, defaults to true
151+
/* Enable (or disable) client class creation, defaults to false
152152
:ENV: PARSE_SERVER_ALLOW_CLIENT_CLASS_CREATION
153-
:DEFAULT: true */
153+
:DEFAULT: false */
154154
allowClientClassCreation: ?boolean;
155155
/* Enable (or disable) custom objectId
156156
:ENV: PARSE_SERVER_ALLOW_CUSTOM_OBJECT_ID

0 commit comments

Comments
 (0)