Standards Umbau der Dateien
This commit is contained in:
parent
81df22e4d5
commit
9490831e7f
|
|
@ -27,10 +27,10 @@
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
// FIRST CALL GROUPS, When Groups finished User will call by Groups
|
// FIRST CALL GROUPS, When Groups finished User will call by Groups
|
||||||
createAgencyGroups(groupids[0]);
|
//createAgencyGroups(groupids[0]);
|
||||||
|
|
||||||
//DEV
|
//DEV
|
||||||
//rebuildingStandards();
|
rebuildingStandards();
|
||||||
//addGroupFolder();
|
//addGroupFolder();
|
||||||
//addDirs(dirids[0]);
|
//addDirs(dirids[0]);
|
||||||
})
|
})
|
||||||
|
|
|
||||||
19
api/views.py
19
api/views.py
|
|
@ -18,6 +18,7 @@ from django.contrib.sessions.models import Session
|
||||||
from timemanagement.models import Absence
|
from timemanagement.models import Absence
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from digitaleagentur.utils import *
|
from digitaleagentur.utils import *
|
||||||
|
from standards.models import Standards, NCFile
|
||||||
|
|
||||||
class GetUserId(APIView):
|
class GetUserId(APIView):
|
||||||
#permission_classes = (IsAuthenticated,) # <-- And here
|
#permission_classes = (IsAuthenticated,) # <-- And here
|
||||||
|
|
@ -407,6 +408,16 @@ def SetUserData(request):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getFileIdFromXML(xmlresponse):
|
||||||
|
try:
|
||||||
|
split_response = xmlresponse.split("<oc:fileid>")
|
||||||
|
split_fileele = split_response[1].split("<")
|
||||||
|
return split_fileele[0]
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Standardateien neu zuweisen
|
Standardateien neu zuweisen
|
||||||
'''
|
'''
|
||||||
|
|
@ -420,6 +431,10 @@ def NCSwitchStandardFiles(request):
|
||||||
for f in s.addedfiles.all():
|
for f in s.addedfiles.all():
|
||||||
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><oc:fileid/><d:displayname/></d:prop></d:select><d:from><d:scope><d:href>/files/' + settings.NEXTCLOUD_USER_API + '/Agenturdaten_' + str(agency.pk) + '</d:href><d:depth>infinity</d:depth></d:scope></d:from><d:where><d:like><d:prop><d:displayname/></d:prop><d:literal>' + f.name + '</d:literal></d:like></d:where></d:basicsearch></d:searchrequest>'
|
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><oc:fileid/><d:displayname/></d:prop></d:select><d:from><d:scope><d:href>/files/' + settings.NEXTCLOUD_USER_API + '/Agenturdaten_' + str(agency.pk) + '</d:href><d:depth>infinity</d:depth></d:scope></d:from><d:where><d:like><d:prop><d:displayname/></d:prop><d:literal>' + f.name + '</d:literal></d:like></d:where></d:basicsearch></d:searchrequest>'
|
||||||
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'})
|
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"})
|
return JsonResponse({"status" : "NO AUTH"})
|
||||||
Loading…
Reference in New Issue