diff --git a/adm/templates/adm/adm_import_flow.html b/adm/templates/adm/adm_import_flow.html index 8033235..bcabb0e 100644 --- a/adm/templates/adm/adm_import_flow.html +++ b/adm/templates/adm/adm_import_flow.html @@ -27,10 +27,10 @@ $(document).ready(function(){ // FIRST CALL GROUPS, When Groups finished User will call by Groups - createAgencyGroups(groupids[0]); + //createAgencyGroups(groupids[0]); //DEV - //rebuildingStandards(); + rebuildingStandards(); //addGroupFolder(); //addDirs(dirids[0]); }) diff --git a/api/views.py b/api/views.py index 38f185e..fb06bd5 100644 --- a/api/views.py +++ b/api/views.py @@ -18,6 +18,7 @@ from django.contrib.sessions.models import Session from timemanagement.models import Absence from django.conf import settings from digitaleagentur.utils import * +from standards.models import Standards, NCFile class GetUserId(APIView): #permission_classes = (IsAuthenticated,) # <-- And here @@ -407,6 +408,16 @@ def SetUserData(request): + +def getFileIdFromXML(xmlresponse): + try: + split_response = xmlresponse.split("") + split_fileele = split_response[1].split("<") + return split_fileele[0] + except: + return None + + ''' Standardateien neu zuweisen ''' @@ -420,6 +431,10 @@ def NCSwitchStandardFiles(request): for f in s.addedfiles.all(): filesearchdata = '/files/' + settings.NEXTCLOUD_USER_API + '/Agenturdaten_' + str(agency.pk) + 'infinity' + f.name + '' r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav", data=filesearchdata, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API), headers={'Content-Type' : 'text/xml'}) - print(r.text) - + fileid = getFileIdFromXML(r.text) + if(fileid == None): + pass + else: + ncfile = NCFile.objects.create(agency=s.agency, nc_id=fileid, file_id=f) + s.addedfiles_nc.add(ncfile) return JsonResponse({"status" : "NO AUTH"}) \ No newline at end of file