mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	Implement StoredObjectVoterInterface
An interface was created to be implemented by Stored Doc voters\ these will automatically be tagged and injected into DocStoreVoter.
This commit is contained in:
		@@ -19,11 +19,12 @@ use Chill\MainBundle\Security\Authorization\VoterHelperInterface;
 | 
			
		||||
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
 | 
			
		||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
 | 
			
		||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
 | 
			
		||||
use ChillDocStoreBundle\Security\Authorization\StoredObjectVoterInterface;
 | 
			
		||||
use Psr\Log\LoggerInterface;
 | 
			
		||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
 | 
			
		||||
use Symfony\Component\Security\Core\Security;
 | 
			
		||||
 | 
			
		||||
class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
 | 
			
		||||
class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface, StoredObjectVoterInterface
 | 
			
		||||
{
 | 
			
		||||
    final public const CREATE = 'CHILL_ACCOMPANYING_COURSE_DOCUMENT_CREATE';
 | 
			
		||||
 | 
			
		||||
@@ -70,12 +71,12 @@ class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements Prov
 | 
			
		||||
        return [];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function supports($attribute, $subject): bool
 | 
			
		||||
    public function supports($attribute, $subject): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->voterHelper->supports($attribute, $subject);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
 | 
			
		||||
    public function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
 | 
			
		||||
    {
 | 
			
		||||
        if (!$token->getUser() instanceof User) {
 | 
			
		||||
            return false;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user