Skip to content

Commit 652d874

Browse files
committed
Remove enabled
1 parent a62ba27 commit 652d874

File tree

5 files changed

+4
-22
lines changed

5 files changed

+4
-22
lines changed

spec/ParseFile.spec.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,9 @@ describe('Parse.File testing', () => {
878878
it('disable file upload', async () => {
879879
await reconfigureServer({
880880
fileUpload: {
881-
enabled: false,
881+
enabledForPublic: false,
882+
enabledForAnonymousUser: false,
883+
enabledForAuthenticatedUser: false,
882884
},
883885
});
884886
try {
@@ -887,13 +889,12 @@ describe('Parse.File testing', () => {
887889
fail('should not have been able to save file.');
888890
} catch (e) {
889891
expect(e.code).toBe(130);
890-
expect(e.message).toBe('File upload is not enabled.');
892+
expect(e.message).toBe('Public file upload is not enabled.');
891893
}
892894
});
893895
it('disable for public', async () => {
894896
await reconfigureServer({
895897
fileUpload: {
896-
enabled: true,
897898
enabledForPublic: false,
898899
},
899900
});
@@ -910,7 +911,6 @@ describe('Parse.File testing', () => {
910911
it('disable for public allow user', async () => {
911912
await reconfigureServer({
912913
fileUpload: {
913-
enabled: true,
914914
enabledForPublic: false,
915915
},
916916
});
@@ -926,8 +926,6 @@ describe('Parse.File testing', () => {
926926
it('disable for anonymous', async () => {
927927
await reconfigureServer({
928928
fileUpload: {
929-
enabled: true,
930-
enabledForPublic: false,
931929
enabledForAnonymousUser: false,
932930
},
933931
});
@@ -945,7 +943,6 @@ describe('Parse.File testing', () => {
945943
it('enable for anonymous', async () => {
946944
await reconfigureServer({
947945
fileUpload: {
948-
enabled: true,
949946
enabledForPublic: false,
950947
enabledForAnonymousUser: true,
951948
},
@@ -962,7 +959,6 @@ describe('Parse.File testing', () => {
962959
it('enable for anonymous but not authenticated', async () => {
963960
await reconfigureServer({
964961
fileUpload: {
965-
enabled: true,
966962
enabledForPublic: false,
967963
enabledForAnonymousUser: true,
968964
enabledForAuthenticatedUser: false,

src/Options/Definitions.js

-6
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,6 @@ module.exports.IdempotencyOptions = {
548548
},
549549
};
550550
module.exports.FileUploadOptions = {
551-
enabled: {
552-
env: 'PARSE_SERVER_FILE_UPLOAD_ENABLED',
553-
help: 'Files can be uploaded with Parse Server.',
554-
action: parsers.booleanParser,
555-
default: true,
556-
},
557551
enabledForAnonymousUser: {
558552
env: 'PARSE_SERVER_FILE_UPLOAD_ENABLED_FOR_ANONYMOUS_USER',
559553
help: 'File upload is enabled for Anonymous Users.',

src/Options/docs.js

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@
122122

123123
/**
124124
* @interface FileUploadOptions
125-
* @property {Boolean} enabled Files can be uploaded with Parse Server.
126125
* @property {Boolean} enabledForAnonymousUser File upload is enabled for Anonymous Users.
127126
* @property {Boolean} enabledForAuthenticatedUser File upload is enabled for authenticated users.
128127
* @property {Boolean} enabledForPublic File upload is enabled for anyone with access to the Parse Server file upload endpoint, regardless of user authentication.

src/Options/index.js

-3
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,6 @@ export interface IdempotencyOptions {
290290
ttl: ?number;
291291
}
292292
export interface FileUploadOptions {
293-
/* Files can be uploaded with Parse Server.
294-
:DEFAULT: true */
295-
enabled: ?boolean;
296293
/* File upload is enabled for Anonymous Users.
297294
:DEFAULT: false */
298295
enabledForAnonymousUser: ?boolean;

src/Routers/FilesRouter.js

-4
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ export class FilesRouter {
9494

9595
async createHandler(req, res, next) {
9696
const config = req.config;
97-
if (!req.config.fileUpload.enabled && req.config.fileUpload.enabled != null) {
98-
next(new Parse.Error(Parse.Error.FILE_SAVE_ERROR, 'File upload is not enabled.'));
99-
return;
100-
}
10197
if (
10298
!req.config.fileUpload.enabledForAnonymousUser &&
10399
req.auth.user &&

0 commit comments

Comments
 (0)