Implements controllers for locking and unlocking with the webdav protocol (wip)

This commit is contained in:
2026-04-02 14:36:13 +02:00
parent a3b857253a
commit ff9e4f2709
10 changed files with 543 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\DocStoreBundle\Dav\Utils;
use Symfony\Component\HttpFoundation\Request;
final readonly class LockTokenParser
{
public function parseLockToken(Request $request): ?string
{
$token = $request->headers->get('lock-token');
if (null === $token) {
return null;
}
if (str_starts_with($token, '"')) {
$token = substr($token, 1, -1);
}
if (str_starts_with($token, '<')) {
$token = substr($token, 1);
}
if (str_ends_with($token, '>')) {
$token = substr($token, 0, -1);
}
if (str_ends_with($token, '"')) {
$token = substr($token, 1, -1);
}
return $token;
}
}