<?phpnamespaceApp\Security\Voter;useApp\Entity\User;useSymfony\Component\Security\Core\Authentication\Token\TokenInterface;useSymfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;useSymfony\Component\Security\Core\Authorization\Voter\Voter;abstractclassAbstractVoterextendsVoter{constLIST='list';// view the list of objectsconstVIEW='view';// view the detail of one objectconstCREATE='create';// create a new objectconstEDIT='edit';// update an existing objectconstDELETE='delete';// delete an existing objectconstEXPORT='export';// (for the native Sonata export links)constALL='all';// grants LIST, VIEW, CREATE, EDIT, DELETE and EXPORTprivate$decisionManager;publicfunction__construct(AccessDecisionManagerInterface$decisionManager){$this->decisionManager=$decisionManager;}protectedstaticfunctionsupportsAttribute($attribute){// Est-ce que l'action demandée existeif(!in_array($attribute,array(self::LIST,self::VIEW,self::CREATE,self::EDIT,self::DELETE,self::EXPORT,self::ALL))){returnfalse;}returntrue;}abstractprotectedfunctionvoteOnAttribute($attribute,$subject,TokenInterface$token);}