mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Setup AccompanyingPeriodWorkEvaluationStoredObjectVoter.php to use AccompanyingPeriodWorkRepository.php
The voter was not checking the correct permissions to\ establish whether a user can see/edit a storedObject\ The right to see/edit an AccompanyingPeriodWork has to\ be checked.
This commit is contained in:
@@ -6,15 +6,15 @@ use Chill\DocStoreBundle\Repository\AssociatedEntityToStoredObjectInterface;
|
||||
use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum;
|
||||
use Chill\DocStoreBundle\Security\Authorization\StoredObjectVoters\AbstractStoredObjectVoter;
|
||||
use Chill\DocStoreBundle\Service\WorkflowDocumentService;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocumentRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkEvaluationDocumentVoter;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
class AccompanyingPeriodWorkEvaluationStoredObjectVoter extends AbstractStoredObjectVoter
|
||||
{
|
||||
public function __construct(
|
||||
private readonly AccompanyingPeriodWorkEvaluationDocumentRepository $repository,
|
||||
private readonly AccompanyingPeriodWorkRepository $repository,
|
||||
Security $security,
|
||||
WorkflowDocumentService $workflowDocumentService
|
||||
){
|
||||
@@ -31,15 +31,14 @@ class AccompanyingPeriodWorkEvaluationStoredObjectVoter extends AbstractStoredOb
|
||||
*/
|
||||
protected function getClass(): string
|
||||
{
|
||||
return AccompanyingPeriodWorkEvaluationDocument::class;
|
||||
return AccompanyingPeriodWork::class;
|
||||
}
|
||||
|
||||
protected function attributeToRole(StoredObjectRoleEnum $attribute): string
|
||||
{
|
||||
//Question: there is no update/edit check in AccompanyingPeriodWorkEvaluationDocumentVoter, so for both SEE and EDIT of the
|
||||
// stored object I check with SEE right in AccompanyingPeriodWorkEvaluationDocumentVoter, correct?
|
||||
return match ($attribute) {
|
||||
StoredObjectRoleEnum::SEE, StoredObjectRoleEnum::EDIT => AccompanyingPeriodWorkEvaluationDocumentVoter::SEE,
|
||||
StoredObjectRoleEnum::SEE => AccompanyingPeriodWorkVoter::SEE,
|
||||
StoredObjectRoleEnum::EDIT => AccompanyingPeriodWorkVoter::UPDATE,
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user