fixes quick for accompanying cours edocument voter

This commit is contained in:
2021-09-24 13:51:43 +02:00
parent 388db459bf
commit 62f8d2c01d
2 changed files with 10 additions and 16 deletions

View File

@@ -7,6 +7,7 @@ use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
use Chill\MainBundle\Entity\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
use Psr\Log\LoggerInterface;
@@ -57,30 +58,23 @@ class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements Prov
self::DELETE
];
}
protected function supports($attribute, $subject)
{
if (\in_array($attribute, $this->getRoles()) && $subject instanceof AccompanyingCourseDocument) {
if (\in_array($attribute, $this->getRoles())) {
return true;
}
//if ($subject instanceof AccompanyingPeriod && $attribute === self::CREATE) {
return true;
//}
return false;
}
protected function isGranted($attribute, $report, $user = null)
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
{
if (! $user instanceof User){
return false;
}
// TODO
// return $this->helper->userHasAccess($user, $report, $attribute);
return true;
}
public function getRolesWithoutScope()
{
return array();