Minor fixes for closing accompanying course:

* check that transition can be applyied in menu;
* change organisation for activityVoter, and check for authorization in
    Activity Controller
* fix label 'create' in accompanying course document
* minor fix in accompanying course document voter
* change color when course is closed and show old user, and startdate /
    enddate
This commit is contained in:
2021-11-22 20:24:08 +01:00
parent 4c1e416a14
commit 0867965d9c
8 changed files with 95 additions and 28 deletions

View File

@@ -62,7 +62,7 @@
<ul class="record_actions">
<li class="create">
<a href="{{ path('accompanying_course_document_new', {'course': accompanyingCourse.id}) }}" class="btn btn-create">
{{ 'Create new document' | trans }}
{{ 'Create'|trans }}
</a>
</li>
</ul>

View File

@@ -71,17 +71,21 @@ class AccompanyingCourseDocumentVoter extends AbstractChillVoter implements Prov
return false;
}
if ($subject instanceof AccompanyingCourseDocument
&& !$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getCourse())) {
return false;
}
if ($subject instanceof AccompanyingPeriod) {
if (AccompanyingPeriod::STEP_CLOSED === $subject->getStep()) {
if (\in_array($attribute, [self::UPDATE, self::CREATE, self::DELETE])) {
if ($attribute === self::CREATE) {
return false;
}
}
} elseif ($subject instanceof AccompanyingCourseDocument) {
if (!$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getCourse())) {
return false;
}
if (AccompanyingPeriod::STEP_CLOSED === $subject->getCourse()->getStep()
&& \in_array($attribute, [self::CREATE, self::DELETE, self::UPDATE])) {
return false;
}
}
return $this->voterHelper->voteOnAttribute($attribute, $subject, $token);