Dateien werden gelöscht im Standard wenn auch in Cloud
This commit is contained in:
parent
fc35ce24ac
commit
15363595d8
|
|
@ -26,4 +26,5 @@ urlpatterns = [
|
|||
# EXTERNAL FROM NC
|
||||
path('logout/<str:uid>', views.apilogout, name="api-logout"),
|
||||
path('uschanged/<str:uid>/<str:sid>', views.userChangedInNc, name="api-userchanged"),
|
||||
path('deletefile/<slug:fid>/<slug:secretkey>', views.deleteNCFile, name="api-deletencfile"),
|
||||
]
|
||||
17
api/views.py
17
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"})
|
||||
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"})
|
||||
Binary file not shown.
|
|
@ -1141,7 +1141,6 @@ def getNCFileInfosURL(request, ncid):
|
|||
try:
|
||||
filesearchdata = '<?xml version="1.0" encoding="UTF-8"?><d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:basicsearch><d:select><d:prop><d:displayname/></d:prop></d:select><d:from><d:scope><d:href>/files/' + request.user.username + '</d:href><d:depth>infinity</d:depth></d:scope></d:from><d:where><d:eq><d:prop><oc:fileid/></d:prop><d:literal>' + str(ncid) + '</d:literal></d:eq></d:where></d:basicsearch></d:searchrequest>'
|
||||
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("<d:href>")
|
||||
split_fileele = split_response[1].split("</d:href>")
|
||||
# Return file-link except first slash in string
|
||||
|
|
|
|||
Loading…
Reference in New Issue