The path for Symfony container XML in the rector configuration file has been updated. This adjustment specifically refers to the internal testing application. By updating this path, consistency and efficiency within the testing process will be promoted.
En symfony 5.4 le typage a été vraiment amélioré, et phpstan peut détecter plus d'erreur potentielles.
Mais le problème est que Symfony "type" les `User` avec son propre `Symfony\Component\Security\Core\User\UserInterface` alors qu'on a besoin de `Chill\MainBundle\Entity\User`.
Imaginons qu'on a ceci:
```php
namespace Chill\Bundle\Service;
final readonly class SomeService
{
public function myMethod(\Chill\MainBundle\Entity\User $user): void
{
// ...
}
}
```
Quand on l'appelle dans un contrôleur ou dans un service:
```php
namespace Chill\Bundle\Service;
use Symfony\Component\Security\Core\Security;
final readonly OtherService
{
public function __construct(private Security $security, private SomeService $service) {}
public function __invoke(): void
{
$this->service->myMethod($this->security->getUser());
}
}
```
PHPstan va se plaindre:
```
Parameter #1 $user of method SomeService::myMethod() expects Chill\MainBundle\Entity\User, Symfony\Component\Security\Core\User\UserInterface|null given.
```
Du coup, j'ai créé ce service:
```php
<?php
namespace Chill\MainBundle\Security;
use Chill\MainBundle\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Security;
/**
* Security helper for Chill user
*
* Provides security-related functionality such as user retrieval, authorization checks,
* and token retrieval, in a context where only an authenticated @see{User::class} is expected.
*
*/
final readonly class ChillSecurity implements AuthorizationCheckerInterface
{
public function hasUser(): bool
{
// implementation detail not shown here
}
public function getUser(): User
{
// implementation detail not shown here
}
public function isGranted($attribute, $subject = null): bool
{
// implementation detail not shown here
}
public function getToken(): ?TokenInterface
{
// implementation detail not shown here
}
}
```
Et maintenant, on peut faire:
```php
namespace Chill\Bundle\Service;
use Chill\MainBundle\Security\ChillSecurity;
final readonly OtherService
{
public function __construct(private ChillSecurity $security, private SomeService $service) {}
public function __invoke(): void
{
$this->service->myMethod($this->security->getUser());
}
}
```
Et tout va bien se passer.
Ca sera dans la version de chill qui fait passer à symfony 5.4.
Added new command file "ConfigureOpenstackObjectStorageCommand.php" under ChillDocStoreBundle that helps in setting up OpenStack container for document storage. Along with the command, added corresponding test file "ConfigureOpenstackObjectStorageCommandTest.php" to ensure the functionality is working as expected.
Introduced two new exceptions, `BadCallToRemoteServer` and `TempUrlRemoteServerException`, to improve error handling in asynchronous file operations. These exceptions are thrown when there are issues with the remote server during an async file operation such as HTTP status codes >= 400 and if the server is unreachable.
Created AsyncUploadExtension under Chill\DocStoreBundle\AsyncUpload\Templating to provide Twig filter functions for generating URLs for asynchronous file uploads. To ensure correctness, AsyncUploadExtensionTest was implemented in Bundle\ChillDocStoreBundle\Tests\AsyncUpload\Templating. Service definitions were also updated in services.yaml.
Serializer groups have been added to the SignedUrl and SignedUrlPost classes to ensure correct serialization. Two new test files were also included: SignedUrlNormalizerTest and SignedUrlPostNormalizerTest which test the normalization of instances of the classes.
The TempUrlOpenstackGenerator now uses a ParameterBag for configuration instead of individual parameters. This simplifies the handling of configuration values and makes the code more maintainable. The parameter configuration has also been included in the chill_doc_store configuration array for a unified approach.
Added new files for handling asynchronous file uploads in ChillDocStoreBundle. The new files include a controller for generating temporary URLs (AsyncUploadController.php), a security authorization file (AsyncUploadVoter.php), and a corresponding test file (AsyncUploadControllerTest.php). These implementations permit asynchronous uploads via POST, GET, and HEAD methods while maintaining security protocols.
Those features were previously stored in champs-libres/async-upload-bundle
This commit introduces several new classes within the ChillDocStore bundle for handling asynchronous uploads onto an Openstack Object Store. Specifically, the TempUrlOpenstackGenerator, SignedUrl, TempUrlGeneratorInterface, TempUrlGenerateEvent, and TempUrlGeneratorException classes have been created.
This implementation will allow for generating "temporary URLs", which assist in securely and temporarily uploading resources to the OpenStack Object Store. This feature enables the handling of file uploads in a more scalable and efficient manner in high-volume environments.
Additionally, corresponding unit tests have also been added to ensure the accuracy of this new feature.
This commit introduces a migration to fix the export for individuals who were created before the introduction of the 'createdAt' column. The 'startdate' column is now updated to match the individual's first activity date. This migration is irreversible. It's been added as a response to Issue #228