]> git.parisson.com Git - teleforma.git/commitdiff
More complete blocking of consultation fictive for users having access to a conferenc...
authorGael Le Mignot <gael@pilotsystems.net>
Fri, 28 Feb 2020 13:54:00 +0000 (14:54 +0100)
committerGael Le Mignot <gael@pilotsystems.net>
Fri, 28 Feb 2020 13:54:00 +0000 (14:54 +0100)
teleforma/models/pro.py
teleforma/templates/teleforma/inc/steps.html
teleforma/views/core.py
teleforma/views/pro.py

index c4005e238322de8d4831b509c99d91e4852e726b..0d00d9bedf28645c36f8cf4daa801a97209f3c55 100644 (file)
@@ -330,7 +330,6 @@ class Auditor(models.Model):
         verbose_name = _('Auditor')
         ordering = ['user__last_name']
 
-
 class SeminarRevision(models.Model):
 
     seminar     = models.ForeignKey(Seminar, related_name="revision", verbose_name=_('seminar'))
index df51abf9aa96287e782a03ad673bacd1eb1d1da2..6ac29594d13a2701eba5c99409383483ce7550c6 100644 (file)
   {% include "teleforma/inc/document_step.html" %}
 {% endwith %}
 
-{% with seminar.question as questions %}
+  {% if not seminar.conference in user.auditor.get.conferences.all %}
+
+  {% with seminar.question as questions %}
   <div class="course_subtitle">
     <h4><img src="{{ STATIC_URL }}/telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Step" %} 4</h4>
   </div>
   {% include "teleforma/inc/question_step.html" %}
-{% endwith %}
+  {% endwith %}
 
 
-{% if seminar_progress == 100 %}
-{% with seminar.docs_correct as docs %}
-   <div class="course_subtitle">
+  {% if seminar_progress == 100 %}
+  {% with seminar.docs_correct as docs %}
+  <div class="course_subtitle">
     <h4><img src="{{ STATIC_URL }}/telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Step" %} 5</h4>
   </div>
   {% include "teleforma/inc/document_step.html" %}
-{% endwith %}
+  {% endwith %}
 
-{% with seminar.form as form %}
+  {% with seminar.form as form %}
   <div class="course_subtitle">
     <h4><img src="{{ STATIC_URL }}/telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Step" %} 6 :</h4>
   </div>
   {% include "teleforma/inc/evaluation_form.html" %}
-{% endwith %}
-{% endif %}
+  {% endwith %}
+  {% endif %}
 
-{% if seminar|validated:user %}
+  {% if seminar|validated:user %}
   <div class="course_subtitle">
     <h4><img src="{{ STATIC_URL }}/telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Step" %} 7</h4>
   </div>
   {% include "teleforma/inc/testimonial_step.html" %}
-{% endif %}
+  {% endif %}
 
+  {% endif %}
index e2400af7634e8410df9579411f85ab84521592ed..8247017fa531eede55ec75a7ceb645754a5804bc 100644 (file)
@@ -320,6 +320,7 @@ class MediaView(DetailView):
             media.set_mime_type()
         if not self.request.user in media.readers.all():
             media.readers.add(self.request.user)
+        context['HOST'] = self.request.META.get('HOST')
         context['media'] = media
         context['mime_type'] = media.mime_type
         context['course'] = media.course
index 8e3f524e6671526c3cbd2b57e2291996e613b40a..a10ab5dba8ad8c5301bc25d4812ed7a00bc80023 100644 (file)
@@ -35,6 +35,7 @@
 
 from teleforma.views.core import *
 from teleforma.context_processors import *
+from django.core.exceptions import PermissionDenied
 
 from telemeta.util.unicode import UnicodeWriter
 
@@ -300,6 +301,10 @@ class AnswerView(SeminarAccessMixin, SeminarRevisionMixin, FormView):
 
         self.question = Question.objects.get(pk=self.kwargs['pk'])
         self.user = self.get_user()
+
+        if self.question.seminar.conference in self.user.auditor.get().conferences.all():
+            raise PermissionDenied
+        
         answers = Answer.objects.filter(user=self.user,
                                         question=self.question).order_by('-date_submitted')
         if answers: