fix: losen constraint to edit assignment

This commit is contained in:
Björn Fromme
2024-01-31 20:10:03 +01:00
parent 2a9e1232ec
commit d2ebb6b70f
+3 -6
View File
@@ -38,12 +38,9 @@ class AssignmentVoter extends Voter
return true; return true;
} }
// Only users with administrative role may edit assignments without applications or dispositions // Only users with administrative role may edit assignments
if (static::EDIT === $attribute && in_array('ROLE_ADMINISTRATIVE', $token->getRoleNames())) { if (static::EDIT === $attribute) {
$assignmentCount = $assignment->getApplications()->count(); return in_array('ROLE_ADMINISTRATIVE', $token->getRoleNames());
$dispositionCount = $assignment->getDispositions()->count();
return 0 === $assignmentCount && 0 === $dispositionCount;
} }
// Only allow applications to open assignments // Only allow applications to open assignments