TG-63 supression template pdf
This commit is contained in:
parent
e5c50d9907
commit
5b429dd78c
@ -1,5 +1,6 @@
|
|||||||
USE OLA;
|
USE OLA;
|
||||||
INSERT INTO SETTINGS VALUES ('BASE_DIRECTORY', '/OLA_RESSOURCES/', 'Répertoire base pour le dépot des fichiers');
|
INSERT INTO SETTINGS VALUES ('BASE_DIRECTORY', '/OLA_RESSOURCES/', 'Répertoire base pour le dépot des fichiers');
|
||||||
|
INSERT INTO SETTINGS VALUES ('TEMPLATES_DIRECTORY', '/OLA_TEMPLATES/', 'Répertoire base pour le dépot des fichiers');
|
||||||
INSERT INTO SETTINGS VALUES ('OLA_URL', 'ola.univ-tlse2.fr/', 'URL de l application');
|
INSERT INTO SETTINGS VALUES ('OLA_URL', 'ola.univ-tlse2.fr/', 'URL de l application');
|
||||||
|
|
||||||
INSERT INTO `USER` VALUES (1, '1', 'sec@univ-tlse2.fr', 'Secrétaire', DEFAULT, 'aZeRtYuIoP', '01.23.45.67.89');
|
INSERT INTO `USER` VALUES (1, '1', 'sec@univ-tlse2.fr', 'Secrétaire', DEFAULT, 'aZeRtYuIoP', '01.23.45.67.89');
|
||||||
|
22
backend/app/api/PdfAPI.py
Normal file
22
backend/app/api/PdfAPI.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
from flask_restful import Resource
|
||||||
|
from flask_restful.reqparse import RequestParser
|
||||||
|
from app.tools.LibPdf import delete_file
|
||||||
|
from model import getParam
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
class LoginAPI(Resource):
|
||||||
|
"""
|
||||||
|
Login Api Resource
|
||||||
|
"""
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
parser = RequestParser()
|
||||||
|
parser.add_argument('templateName', required=True, help="Template name is required !")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if ".." in args:
|
||||||
|
return { "msg" : ".. not allowed in path"}, 400
|
||||||
|
|
||||||
|
delete_file(os.path.join(getParam('TEMPLATES_DIRECTORY'), args['file']))
|
||||||
|
|
@ -78,3 +78,7 @@ def upload_file():
|
|||||||
<input type=submit value=Upload>
|
<input type=submit value=Upload>
|
||||||
</form>
|
</form>
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
def delete_file(pdf_path):
|
||||||
|
if os.path.exists(pdf_path):
|
||||||
|
os.remove(pdf_path)
|
||||||
|
Reference in New Issue
Block a user