From e83307ca6d13dda2851d86c8e75d349bb5db1982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 15 Jul 2024 17:17:56 +0200 Subject: [PATCH] Remove obsolete security checks in StoredObjectVoter This commit eliminates antiquated security checks in the StoredObjectVoter class. Specifically, it removes a chunk of commented out code that checked for certain attributes on the token and also the import for DavTokenAuthenticationEventSubscriber class which is no longer needed. This results in code cleanup and prevents future confusion. --- .../Security/Authorization/StoredObjectVoter.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php index c0851144a..91e767af2 100644 --- a/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php +++ b/src/Bundle/ChillDocStoreBundle/Security/Authorization/StoredObjectVoter.php @@ -12,7 +12,6 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Security\Authorization; use Chill\DocStoreBundle\Entity\StoredObject; -use Chill\DocStoreBundle\Security\Guard\DavTokenAuthenticationEventSubscriber; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\Voter; use Symfony\Component\Security\Core\Security; @@ -35,19 +34,6 @@ class StoredObjectVoter extends Voter protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool { /** @var StoredObject $subject */ - /* - if ( - !$token->hasAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT) - || $subject->getUuid()->toString() !== $token->getAttribute(DavTokenAuthenticationEventSubscriber::STORED_OBJECT) - ) { - return false; - } - - if (!$token->hasAttribute(DavTokenAuthenticationEventSubscriber::ACTIONS)) { - return false; - } - */ - $attributeAsEnum = StoredObjectRoleEnum::from($attribute); // Loop through context-specific voters