mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 00:53:48 +00:00
Dav: add some documentation on classes
This commit is contained in:
@@ -25,6 +25,17 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
/**
|
||||
* Provide endpoint for editing a document on the desktop using dav.
|
||||
*
|
||||
* This controller implements the minimal required methods to edit a document on a desktop software (i.e. LibreOffice)
|
||||
* and save the document online.
|
||||
*
|
||||
* To avoid to ask for a password, the endpoints are protected using a JWT access token, which is inside the
|
||||
* URL. This avoid the DAV Client (LibreOffice) to keep an access token in query parameter or in some header (which
|
||||
* they are not able to understand). The JWT Guard is adapted with a dedicated token extractor which is going to read
|
||||
* the segments (separation of "/"): the first segment must be the string "dav", and the second one must be the JWT.
|
||||
*/
|
||||
final readonly class WebdavController
|
||||
{
|
||||
private PropfindRequestAnalyzer $requestAnalyzer;
|
||||
@@ -33,23 +44,10 @@ final readonly class WebdavController
|
||||
private \Twig\Environment $engine,
|
||||
private StoredObjectManagerInterface $storedObjectManager,
|
||||
private Security $security,
|
||||
private ?JWTDavTokenProviderInterface $davTokenProvider = null,
|
||||
) {
|
||||
$this->requestAnalyzer = new PropfindRequestAnalyzer();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/chdoc/open/{uuid}")
|
||||
*/
|
||||
public function open(StoredObject $storedObject): Response
|
||||
{
|
||||
$accessToken = $this->davTokenProvider?->createToken($storedObject, StoredObjectRoleEnum::EDIT);
|
||||
|
||||
return new DavResponse($this->engine->render('@ChillDocStore/Webdav/open_in_browser.html.twig', [
|
||||
'stored_object' => $storedObject, 'access_token' => $accessToken,
|
||||
]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/dav/{access_token}/get/{uuid}/", methods={"GET", "HEAD"}, name="chill_docstore_dav_directory_get")
|
||||
*/
|
||||
|
Reference in New Issue
Block a user