Fix namespaces and move voters to corresponding bundles

This commit is contained in:
2024-06-27 12:44:36 +02:00
parent 742f2540f6
commit efaad1981d
6 changed files with 8 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
<?php
namespace ChillDocStoreBundle\Security\Authorization\StoredObjectVoters;
namespace Chill\DocStoreBundle\Security\Authorization\StoredObjectVoters;
use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument;
use Chill\DocStoreBundle\Repository\AccompanyingCourseDocumentRepository;
@@ -11,7 +11,7 @@ use Chill\DocStoreBundle\Security\Authorization\StoredObjectVoters\AbstractStore
use Chill\DocStoreBundle\Service\WorkflowDocumentService;
use Symfony\Component\Security\Core\Security;
final class AccompanyingCourseStoredObjectVoter extends AbstractStoredObjectVoter
final class AccompanyingCourseDocumentStoredObjectVoter extends AbstractStoredObjectVoter
{
public function __construct(
private readonly AccompanyingCourseDocumentRepository $repository,

View File

@@ -1,10 +1,9 @@
<?php
namespace src\Bundle\ChillDocStoreBundle\Security\Authorization\StoredObjectVoters;
namespace Chill\DocStoreBundle\Security\Authorization\StoredObjectVoters;
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\AccompanyingPeriodWork;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;

View File

@@ -1,50 +0,0 @@
<?php
namespace src\Bundle\ChillDocStoreBundle\Security\Authorization\StoredObjectVoters;
use Chill\ActivityBundle\Entity\Activity;
use Chill\ActivityBundle\Repository\ActivityDocumentACLAwareRepository;
use Chill\ActivityBundle\Repository\ActivityRepository;
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
use Chill\DocStoreBundle\Repository\AssociatedEntityToStoredObjectInterface;
use Chill\DocStoreBundle\Security\Authorization\StoredObjectRoleEnum;
use Chill\DocStoreBundle\Security\Authorization\StoredObjectVoters\AbstractStoredObjectVoter;
use Chill\DocStoreBundle\Service\WorkflowDocumentService;
use Symfony\Component\Security\Core\Security;
class ActivityStoredObjectVoter extends AbstractStoredObjectVoter
{
public function __construct(
private readonly ActivityRepository $repository,
Security $security,
WorkflowDocumentService $workflowDocumentService
){
parent::__construct($security, $workflowDocumentService);
}
protected function getRepository(): AssociatedEntityToStoredObjectInterface
{
return $this->repository;
}
/**
* @inheritDoc
*/
protected function getClass(): string
{
return Activity::class;
}
protected function attributeToRole(StoredObjectRoleEnum $attribute): string
{
return match ($attribute) {
StoredObjectRoleEnum::EDIT => ActivityVoter::UPDATE,
StoredObjectRoleEnum::SEE => ActivityVoter::SEE_DETAILS,
};
}
protected function canBeAssociatedWithWorkflow(): bool
{
return false;
}
}

View File

@@ -1,49 +0,0 @@
<?php
namespace src\Bundle\ChillDocStoreBundle\Security\Authorization\StoredObjectVoters;
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\EventBundle\Entity\Event;
use Chill\EventBundle\Repository\EventRepository;
use Chill\EventBundle\Security\Authorization\EventVoter;
use Symfony\Component\Security\Core\Security;
class EventStoredObjectVoter extends AbstractStoredObjectVoter
{
public function __construct(
private readonly EventRepository $repository,
Security $security,
WorkflowDocumentService $workflowDocumentService
){
parent::__construct($security, $workflowDocumentService);
}
protected function getRepository(): AssociatedEntityToStoredObjectInterface
{
return $this->repository;
}
/**
* @inheritDoc
*/
protected function getClass(): string
{
return Event::class;
}
protected function attributeToRole(StoredObjectRoleEnum $attribute): string
{
return match ($attribute) {
StoredObjectRoleEnum::EDIT => EventVoter::UPDATE,
StoredObjectRoleEnum::SEE => EventVoter::SEE_DETAILS,
};
}
protected function canBeAssociatedWithWorkflow(): bool
{
return false;
}
}

View File

@@ -1,6 +1,6 @@
<?php
namespace src\Bundle\ChillDocStoreBundle\Security\Authorization\StoredObjectVoters;
namespace Chill\DocStoreBundle\Security\Authorization\StoredObjectVoters;
use Chill\DocStoreBundle\Entity\PersonDocument;
use Chill\DocStoreBundle\Repository\AssociatedEntityToStoredObjectInterface;
@@ -11,7 +11,7 @@ use Chill\DocStoreBundle\Security\Authorization\StoredObjectVoters\AbstractStore
use Chill\DocStoreBundle\Service\WorkflowDocumentService;
use Symfony\Component\Security\Core\Security;
class PersonStoredObjectVoter extends AbstractStoredObjectVoter
class PersonDocumentStoredObjectVoter extends AbstractStoredObjectVoter
{
public function __construct(
private readonly PersonDocumentRepository $repository,