Don't allow access if user has already taken part

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2019-08-01 17:02:45 +02:00
commit c03647a1c4
5 changed files with 97 additions and 0 deletions

View file

@ -527,6 +527,13 @@ class PageController extends Controller {
return false;
}
if ($access === 'registered') {
if ($form->getUnique()) {
$participants = $this->voteMapper->findParticipantsByForm($form->getId());
foreach($participants as $participant) {
// Don't allow access if user has already taken part
if ($participant->getUserId() === $this->userId) return false;
}
}
return true;
}
if ($owner === $this->userId) {