From d2ebb6b70f7619e83d51c9e7c02747271440eda1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 31 Jan 2024 20:10:03 +0100 Subject: [PATCH] fix: losen constraint to edit assignment --- src/Security/Voter/AssignmentVoter.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Security/Voter/AssignmentVoter.php b/src/Security/Voter/AssignmentVoter.php index 66d1115..2d4959b 100644 --- a/src/Security/Voter/AssignmentVoter.php +++ b/src/Security/Voter/AssignmentVoter.php @@ -38,12 +38,9 @@ class AssignmentVoter extends Voter return true; } - // Only users with administrative role may edit assignments without applications or dispositions - if (static::EDIT === $attribute && in_array('ROLE_ADMINISTRATIVE', $token->getRoleNames())) { - $assignmentCount = $assignment->getApplications()->count(); - $dispositionCount = $assignment->getDispositions()->count(); - - return 0 === $assignmentCount && 0 === $dispositionCount; + // Only users with administrative role may edit assignments + if (static::EDIT === $attribute) { + return in_array('ROLE_ADMINISTRATIVE', $token->getRoleNames()); } // Only allow applications to open assignments