|
|
@ -46,6 +46,7 @@ class CourseVoter extends Voter |
|
|
|
if (!\in_array($attribute, $options, true)) { |
|
|
|
if (!\in_array($attribute, $options, true)) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// only vote on Post objects inside this voter |
|
|
|
// only vote on Post objects inside this voter |
|
|
|
return $subject instanceof Course; |
|
|
|
return $subject instanceof Course; |
|
|
|
} |
|
|
|
} |
|
|
@ -54,12 +55,12 @@ class CourseVoter extends Voter |
|
|
|
{ |
|
|
|
{ |
|
|
|
/** @var User $user */ |
|
|
|
/** @var User $user */ |
|
|
|
$user = $token->getUser(); |
|
|
|
$user = $token->getUser(); |
|
|
|
// Anons can enter a course depending of the course visibility |
|
|
|
// Anons can enter a course depending on the course visibility. |
|
|
|
/*if (!$user instanceof UserInterface) { |
|
|
|
/*if (!$user instanceof UserInterface) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}*/ |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
// Admins have access to everything |
|
|
|
// Admins have access to everything. |
|
|
|
if ($this->security->isGranted('ROLE_ADMIN')) { |
|
|
|
if ($this->security->isGranted('ROLE_ADMIN')) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|