From 15363595d8d91bce76974d0e425029b0b75d0d64 Mon Sep 17 00:00:00 2001 From: Holger Trampe Date: Wed, 1 Sep 2021 16:43:19 +0200 Subject: [PATCH] =?UTF-8?q?Dateien=20werden=20gel=C3=B6scht=20im=20Standar?= =?UTF-8?q?d=20wenn=20auch=20in=20Cloud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/urls.py | 1 + api/views.py | 17 ++++++++++++++++- .../__pycache__/counter_tag.cpython-38.pyc | Bin 26526 -> 26509 bytes standards/templatetags/counter_tag.py | 1 - 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/api/urls.py b/api/urls.py index 1731738..f3f50e9 100644 --- a/api/urls.py +++ b/api/urls.py @@ -26,4 +26,5 @@ urlpatterns = [ # EXTERNAL FROM NC path('logout/', views.apilogout, name="api-logout"), path('uschanged//', views.userChangedInNc, name="api-userchanged"), + path('deletefile//', views.deleteNCFile, name="api-deletencfile"), ] \ No newline at end of file diff --git a/api/views.py b/api/views.py index 6000778..cb4a38b 100644 --- a/api/views.py +++ b/api/views.py @@ -439,4 +439,19 @@ def NCSwitchStandardFiles(request): ncfile = NCFile.objects.create(agency=standard.agency, nc_id=fileid, file_id=f) standard.addedfiles_nc.add(ncfile) return JsonResponse({"status" : response_status}) - return JsonResponse({"status" : "NO AUTH"}) \ No newline at end of file + return JsonResponse({"status" : "NO AUTH"}) + +@api_view(['GET'], ) +def deleteNCFile(request, fid, secretkey): + if request.method == "GET": + if(secretkey == '87zuhjk87GHJ546tzgvhas76aaskbdhr45edfVHAKia87s6gbAVGFGSR3451627gBHAKJBN'): + try: + file_to_del = NCFile.objects.filter(nc_id=fid).first() + file_to_del.delete() + except: + pass + return JsonResponse({"status" : 'true'}) + else: + return JsonResponse({"status" : "NO AUTH"}) + else: + return JsonResponse({"status" : "NO AUTH"}) \ No newline at end of file diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index c73c812a540f0111cd35e013867487a65c3047c1..eb5d89b4967977b7122da1f2902aa2d9e1ac239e 100644 GIT binary patch delta 66 zcmbPtp0W2lBX1}#FBbz4uzBkz=56FHNn~pQ@~R3Z>&K={{+gJ<$UQkONpJGRqyTOK SkUAzNMj1wp&F_*numAvET@m{L delta 101 zcmeA@&p7WqBX1}#FBbz4IJ@g7)@|f1No4B-@~WyP>&Lptm2lQDXK^(%GBSYZ1>7lI z3mI!!YFJXZB^efQPrjd6!pJi@BuS64VRBtk2(J*xASNb88Ac68uFZFoHn0EyGshW< diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index ba88977..a70e798 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -1141,7 +1141,6 @@ def getNCFileInfosURL(request, ncid): try: filesearchdata = '/files/' + request.user.username + 'infinity' + str(ncid) + '' r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav/", data=filesearchdata, headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid}) - print(r.text) split_response = r.text.split("") split_fileele = split_response[1].split("") # Return file-link except first slash in string