forked from ScoDoc/ScoDoc
Bug fix: accès aux fichiers justificatifs
This commit is contained in:
parent
a4fbc2b80e
commit
99b182e1c7
@ -24,7 +24,6 @@ from app.models import (
|
||||
Justificatif,
|
||||
Departement,
|
||||
FormSemestre,
|
||||
FormSemestreInscription,
|
||||
)
|
||||
from app.models.assiduites import (
|
||||
compute_assiduites_justified,
|
||||
@ -647,15 +646,16 @@ def justif_import(justif_id: int = None):
|
||||
|
||||
|
||||
@bp.route("/justificatif/<int:justif_id>/export/<filename>", methods=["GET", "POST"])
|
||||
@api_web_bp.route("/justificatif/<int:justif_id>/export/<filename>", methods=["GET", "POST"])
|
||||
@api_web_bp.route(
|
||||
"/justificatif/<int:justif_id>/export/<filename>", methods=["GET", "POST"]
|
||||
)
|
||||
@scodoc
|
||||
@login_required
|
||||
@permission_required(Permission.AbsChange)
|
||||
def justif_export(justif_id: int = None, filename: str = None):
|
||||
@permission_required(Permission.AbsJustifView)
|
||||
def justif_export(justif_id: int | None = None, filename: str | None = None):
|
||||
"""
|
||||
Retourne un fichier d'une archive d'un justificatif
|
||||
"""
|
||||
|
||||
# On récupère le justificatif concerné
|
||||
query: Query = Justificatif.query.filter_by(id=justif_id)
|
||||
if g.scodoc_dept:
|
||||
|
@ -13,11 +13,17 @@
|
||||
{% else%}
|
||||
{% include "assiduites/widgets/tableau_actions/details.j2" %}
|
||||
{% endif %}
|
||||
<br>
|
||||
<hr>
|
||||
<br>
|
||||
<a href="" id="lien-retour">Retour</a>
|
||||
|
||||
{% if not current_user.has_permission(sco.Permission.AbsJustifView)%}
|
||||
<div class="help fontred" style="margin-top: 16px;">
|
||||
Vous n'avez pas la permission d'ouvrir les fichiers justificatifs
|
||||
déposés par d'autres personnes.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div style="margin-top: 32px;">
|
||||
<a href="" id="lien-retour">retour</a>
|
||||
</div>
|
||||
<script>
|
||||
window.addEventListener('load', () => {
|
||||
document.getElementById("lien-retour").href = document.referrer;
|
||||
|
@ -90,10 +90,14 @@
|
||||
<div>Total : {{objet.justification.fichiers.total}} </div>
|
||||
<ul>
|
||||
{% for filename in objet.justification.fichiers.filenames %}
|
||||
<li><a
|
||||
href="{{url_for('api.justif_export',justif_id=objet.justif_id,filename=filename, scodoc_dept=g.scodoc_dept)}}">{{filename}}</a>
|
||||
<li>
|
||||
<a
|
||||
href="{{url_for('apiweb.justif_export',justif_id=objet.justif_id,filename=filename, scodoc_dept=g.scodoc_dept)}}">{{filename}}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if not objet.justification.fichiers.filenames %}
|
||||
<li class="fontred">fichiers non visibles</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<span class="text">Aucun</span>
|
||||
|
@ -53,7 +53,7 @@ Actuellement noté{{etud.e}} en <b>{{objet_name|lower()}}</b> du {{objet.date_de
|
||||
<li data-id="{{filename}}">
|
||||
<a data-file="{{filename}}">❌</a>
|
||||
<a data-link=""
|
||||
href="{{url_for('api.justif_export',justif_id=objet.justif_id,filename=filename, scodoc_dept=g.scodoc_dept)}}"><span
|
||||
href="{{url_for('apiweb.justif_export',justif_id=objet.justif_id,filename=filename, scodoc_dept=g.scodoc_dept)}}"><span
|
||||
data-file="{{filename}}">{{filename}}</span></a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.6.66"
|
||||
SCOVERSION = "9.6.67"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user