stable

Clone or download

Read-only

Document manager upload endpoint can be used cross-origin like the REST API

This endpoint will be used after a call to the Tuleap REST API so it should as accessible as the REST API otherwise cross origin client will be broken. To keep the Tus server as interoperable as possible, PSR-15 middlewares are used to set the necessary headers. Sadly, Tuleap still supports PHP 5.6 so look alike interfaces are introduced in the meantime. Once the PHP 5.6 support is dropped, these interfaces should be swapped out for the PSR interfaces. How to access the test upload endpoint is described in the introductory commit 426ca739d33e52787ad1439f52a5c8d658d56c8d. This is part of story #12612: upload document via REST route Change-Id: I47fc0e04c90a81f6fba039200d6c80c3f666b8ce

Modified Files

Name
A plugins/docman/include/Tus/TusCORSMiddleware.php +48 −0 Go to diff View file
A plugins/docman/include/Tus/TusFileProvider.php +29 −0 Go to diff View file
M plugins/docman/include/Tus/TusServer.php +22 −5 Go to diff View file
A plugins/docman/include/Upload/DocumentToUploadProvider.php +49 −0 Go to diff View file
M plugins/docman/include/Upload/FileUploadController.php +21 −17 Go to diff View file
A plugins/docman/include/Upload/FileUploadDispatcher.php +57 −0 Go to diff View file
M plugins/docman/include/docmanPlugin.class.php +6 −1 Go to diff View file
A plugins/docman/phpunit/Tus/TusCORSMiddlewareTest.php +73 −0 Go to diff View file
M plugins/docman/phpunit/Tus/TusServerTest.php +116 −109 Go to diff View file
A src/common/Http/Server/AlwaysSuccessfulRequestHandler.php +42 −0 Go to diff View file
A src/common/Http/Server/MiddlewareInterface.php +37 −0 Go to diff View file
A src/common/Http/Server/NullServerRequest.php +31 −0 Go to diff View file
A src/common/Http/Server/RequestHandlerInterface.php +37 −0 Go to diff View file
A src/common/REST/TuleapRESTCORSMiddleware.php +49 −0 Go to diff View file
M src/www/api/index.php +10 −4 Go to diff View file
A tests/phpunit/common/REST/TuleapRESTCORSMiddlewareTest.php +71 −0 Go to diff View file