mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
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:
@@ -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>
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user