Commit Graph

106 Commits

Author SHA1 Message Date
84f515d451 Merge remote-tracking branch 'origin/master' into upgrade-sf5 2024-05-28 14:16:01 +02:00
56d173046d fix phpstan, cs, and rector rules 2024-05-28 12:54:56 +02:00
579bd829f8 Apply rector rules: symfony up to 54 2024-04-04 23:30:25 +02:00
553fb271e4 fix container operations within tests 2024-04-04 22:26:42 +02:00
92800f5dd0 fix cs 2024-04-04 22:19:56 +02:00
d6a6cc2572 Rename chill.role tag to chill_main.provide_role and optimize role provider
The `chill.role` tag has been renamed to `chill_main.provide_role` to prevent any confusion and make the namespaces more consistent. During this process, the class RoleProvidersCompilerPass was deleted, simplifying the role provision process by injecting tagged services directly into the RoleProvider. The change is also reflected in multiple YAML service configurations and explained in the MIGRATION.md file.
2024-04-03 17:14:02 +02:00
f889d67e94 fixes after merge of master into upgrade-sf4 2024-02-12 22:31:16 +01:00
37af488f69 Merge branch 'master' into upgrade-sf5 2024-02-12 21:50:34 +01:00
036fe8d6f8 upgrade php-cs 3.49 2024-02-07 10:43:53 +01:00
27ce322690 upgrade php-cs-fixer to 3.47.0 2024-01-22 12:14:39 +01:00
3c8e59e088 php cs fixes after updating php cs fixer 2024-01-10 10:31:25 +01:00
af663cf27c Create the helper ChillSecurity
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.
2023-12-12 22:43:24 +01:00
bc2041cbdd apply more cs rules for php-cs 2023-10-17 13:27:03 +02:00
a6fcdb5256 Merge remote-tracking branch 'origin/rector/rules-symfony' into rector/rules-symfony 2023-10-16 18:07:42 +02:00
6b8d6b76ba Upgrade code from 146 to new standards 2023-10-16 18:04:40 +02:00
51a4ffca2e Fix cs with new cs rules (php-cs-fixer version 3.35) 2023-10-16 11:59:49 +02:00
58e189ee07 Improve type declaration 2023-10-04 11:21:39 +02:00
d8b0e0671a ScopeResolverDispatcher: better type hinting 2023-09-26 16:59:09 +02:00
cd9611a669 Remove unused dependency on DefaultVoter (+ fix when throwing an exception) 2023-09-13 10:12:04 +02:00
d3b68f8f8f AuthorizationHelper: compare center and scope based on id, not on equality
For an unknown reason, in some circumstances, the use of the `===` comparator does not work when comparing Center instances and Scope instances. Then, we compare them based on the id.
2023-09-13 10:08:44 +02:00
d2323e91ca new cs rule: single_line_empty_body
Rule is added to the last version of php-cs-fixer
2023-09-12 15:58:59 +02:00
e72df84442 DX: rector corrections 2023-09-01 11:08:13 +02:00
7c58880139 Remove usage of deprecated Role class 2023-08-31 17:08:18 +02:00
f570fe92a5 apply rector rules 2023-07-28 02:40:02 +02:00
c20f65eebb apply rector rules: symfony **UP TO** 44 2023-07-28 01:52:53 +02:00
aa553db659 apply rector rules after updating the code with master branch 2023-07-19 23:43:26 +02:00
023a29cb78 apply rector rules: php up to php82 2023-07-19 23:19:50 +02:00
74ed34ba97 apply rules rector 2023-07-19 22:48:26 +02:00
224c2c74e8 Merge remote-tracking branch 'origin/master' into rector/rules-up-to-php80
Conflicts:
	src/Bundle/ChillActivityBundle/Controller/ActivityController.php
	src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php
	src/Bundle/ChillActivityBundle/Menu/PersonMenuBuilder.php
	src/Bundle/ChillActivityBundle/Repository/ActivityACLAwareRepository.php
	src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php
	src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php
	src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/MSGraphUserRepository.php
	src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php
	src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php
	src/Bundle/ChillDocStoreBundle/Repository/PersonDocumentACLAwareRepository.php
	src/Bundle/ChillEventBundle/Search/EventSearch.php
	src/Bundle/ChillMainBundle/Controller/ExportController.php
	src/Bundle/ChillMainBundle/Controller/PermissionsGroupController.php
	src/Bundle/ChillMainBundle/Cron/CronManager.php
	src/Bundle/ChillMainBundle/Entity/CronJobExecution.php
	src/Bundle/ChillMainBundle/Export/ExportManager.php
	src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php
	src/Bundle/ChillMainBundle/Form/Type/Listing/FilterOrderType.php
	src/Bundle/ChillMainBundle/Repository/NotificationRepository.php
	src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelper.php
	src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperBuilder.php
	src/Bundle/ChillMainBundle/Templating/Listing/FilterOrderHelperFactory.php
	src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
	src/Bundle/ChillPersonBundle/Controller/SocialWorkSocialActionApiController.php
	src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php
	src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriod.php
	src/Bundle/ChillPersonBundle/Export/Export/ListHouseholdInPeriod.php
	src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodACLAwareRepository.php
	src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php
	src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodContext.php
	src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php
	src/Bundle/ChillPersonBundle/Service/DocGenerator/PersonContext.php
	src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php
	src/Bundle/ChillTaskBundle/Controller/SingleTaskController.php
2023-07-17 12:49:13 +02:00
dd344aed52 Implements right "see confidential course" on method findByPerson
Add unit tests for that
2023-07-04 15:59:39 +02:00
7e19419861 fixes for last rebase and fixes for runtime 2023-04-28 23:03:36 +02:00
c35994203d fix phpstan issues 2023-04-28 22:55:01 +02:00
dde3002100 DX: apply rector rules up to php8.0 2023-04-28 22:30:33 +02:00
9918cf2d58 Fix: authorization helper won't send a list of center if an admin is authenticated 2023-04-24 15:50:27 +02:00
cb1ea8c622 DX: [mailer] deprecate the chill mailer based on swift mailer 2023-04-19 12:23:15 +02:00
4db1ff405e fix new phpstan issues 2023-04-11 13:04:08 +02:00
841bdb0ebf fix issues from master 2023-04-11 11:43:01 +02:00
ef13833966 Fixed: [create person] handle case when the user has two differents groups in the same center
Fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/72
2023-04-11 10:16:09 +02:00
386d1e44d0 Fixed: [accompanying course document] fix access to accompanying course document
The entity AccompanyingCourseDocument didn't had any center associated with this entity. Implementing the interface `HasCenterInterface` fixed the problem.

Fix https://gitlab.com/Chill-Projet/chill-bundles/-/issues/83
2023-04-05 19:29:33 +02:00
584ac05b53 DX: fix phpstan errors 2023-02-04 01:19:34 +01:00
e7ac8aafe1 DX: Fix missing import for AuthorizationHelperForCurrentUserInterface 2023-01-11 16:16:48 +01:00
1585a73974 DX: [authorization helper] Create an authorization helper with current user already available
See https://gitlab.com/Chill-Projet/chill-bundles/-/issues/14
2022-12-21 17:25:22 +01:00
74673380aa Fixed: [calendar] refactor ACL on calendar 2022-11-28 12:22:58 +01:00
43791badd5 Feature: [saved export] Edit and delete saved exports 2022-11-08 19:24:22 +01:00
79e9906a05 Feature: [saved export] Générate a report from a saved export 2022-11-08 18:02:26 +01:00
0609fdee14 [workflow] Feature: allow user to retrieve the access link for the
workflow + show dest email for a workflow
2022-10-10 20:52:07 +02:00
f64952a93e Merge branch 'master' into 111_exports_suite 2022-10-08 00:50:17 +02:00
6b5f746efc Remove deprecation of AuthorizationHelper::getReachableScope, as it is
widely used
2022-10-08 00:23:07 +02:00
9699e2304a fix cs: declare type and license header mismatch 2022-10-06 22:25:43 +02:00
49731777b4 fix cs: declare type and license header mismatch 2022-10-06 20:51:44 +02:00