feat: allow withdrawal of application unless rejected

This commit is contained in:
Björn Fromme
2024-12-02 14:27:40 +01:00
parent 8aca2a5e87
commit 4d2f37eec1
2 changed files with 11 additions and 7 deletions
+7 -5
View File
@@ -54,12 +54,14 @@ class ApplicationVoter extends Voter
if ($this->security->isGranted('ROLE_TEAMER') && in_array($attribute, $teamerAttributes)) {
$teamer = $user->getTeamer();
if ($teamer !== $application->getTeamer()) {
return false;
}
return match ($attribute) {
static::WITHDRAW => $teamer === $application->getTeamer(),
static::DELETE => $teamer === $application->getTeamer()
&& Application::STATUS_REJECTED === $status,
static::VIEW => $teamer === $application->getTeamer()
&& Application::STATUS_REJECTED !== $status,
static::DELETE => Application::STATUS_REJECTED === $status,
static::VIEW, static::WITHDRAW => Application::STATUS_REJECTED !== $status,
default => false,
};
}