mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 14:19:01 +02:00
Disabled login requirement to upload files for write shared projects (#2294)
GitOrigin-RevId: b24edd10dbe21845ff9199fc4120678cfa04ddcd
This commit is contained in:
committed by
sharelatex
parent
ed2b572fe7
commit
28fd277172
@@ -1,13 +1,3 @@
|
||||
/* eslint-disable
|
||||
no-unused-vars,
|
||||
*/
|
||||
// TODO: This file was created by bulk-decaffeinate.
|
||||
// Fix any style issues and re-enable lint.
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const AuthorizationMiddleware = require('../Authorization/AuthorizationMiddleware')
|
||||
const AuthenticationController = require('../Authentication/AuthenticationController')
|
||||
const ProjectUploadController = require('./ProjectUploadController')
|
||||
@@ -28,18 +18,30 @@ module.exports = {
|
||||
ProjectUploadController.uploadProject
|
||||
)
|
||||
|
||||
return webRouter.post(
|
||||
'/Project/:Project_id/upload',
|
||||
RateLimiterMiddleware.rateLimit({
|
||||
endpointName: 'file-upload',
|
||||
params: ['Project_id'],
|
||||
maxRequests: 200,
|
||||
timeInterval: 60 * 30
|
||||
}),
|
||||
AuthenticationController.requireLogin(),
|
||||
AuthorizationMiddleware.ensureUserCanWriteProjectContent,
|
||||
ProjectUploadController.multerMiddleware,
|
||||
ProjectUploadController.uploadFile
|
||||
)
|
||||
const fileUploadEndpoint = '/Project/:Project_id/upload'
|
||||
const fileUploadRateLimit = RateLimiterMiddleware.rateLimit({
|
||||
endpointName: 'file-upload',
|
||||
params: ['Project_id'],
|
||||
maxRequests: 200,
|
||||
timeInterval: 60 * 30
|
||||
})
|
||||
if (Settings.allowAnonymousReadAndWriteSharing) {
|
||||
webRouter.post(
|
||||
fileUploadEndpoint,
|
||||
fileUploadRateLimit,
|
||||
AuthorizationMiddleware.ensureUserCanWriteProjectContent,
|
||||
ProjectUploadController.multerMiddleware,
|
||||
ProjectUploadController.uploadFile
|
||||
)
|
||||
} else {
|
||||
webRouter.post(
|
||||
fileUploadEndpoint,
|
||||
fileUploadRateLimit,
|
||||
AuthenticationController.requireLogin(),
|
||||
AuthorizationMiddleware.ensureUserCanWriteProjectContent,
|
||||
ProjectUploadController.multerMiddleware,
|
||||
ProjectUploadController.uploadFile
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user