oauth2 und migration api

This commit is contained in:
holger.trampe 2021-07-23 11:55:40 +02:00
parent e90a91355a
commit 4e2f08a5a0
1 changed files with 18 additions and 39 deletions

View File

@ -67,6 +67,10 @@ import base64
from django.http import HttpResponse
# OAUTH
def oauthCallBack(request):
return None
def getICSFile(request, ag):
if 'HTTP_AUTHORIZATION' in request.META:
auth = request.META['HTTP_AUTHORIZATION'].split()
@ -222,45 +226,6 @@ def getICSFileExAll(request, code, ag):
response.status_code = 404
return response
'''
def getICSFileExAll(request, code, ag):
if(request.method == "GET"):
#try:
agency = Agency.objects.get(pk=ag)
if agency != None and agency.agencycal_publicstatus == 1 and str(code) == str(agency.agencycalurl_all):
c = Calendar()
absencedays = Absence.objects.filter(agency=ag).exclude(confirm_status=2)
for ab in absencedays:
if ab.start != None and ab.end != None:
e = Event()
e.name = ab.user.first_name + " " + ab.user.last_name + " | " + ab.reason.name
e.uid = "da-ab-" + str(ab.pk)
if ab.start < ab.end:
e.begin = ab.start
e.end = ab.end
else:
e.begin = ab.start
e.end = ab.start + timedelta(minutes=1)
e.allday = True
c.events.add(e)
return HttpResponse(c, content_type='text/calendar')
else:
realm = ""
response = HttpResponse()
response.status_code = 400
return response
except:
realm = ""
response = HttpResponse()
response.status_code = 403
return response
else:
realm = ""
response = HttpResponse()
response.status_code = 404
return response
'''
'''
@ -761,6 +726,20 @@ def showUserLog(request, pk):
@login_required
def dashboard(request):
'''
headers = {
'Authorization': 'Bearer ' + request.session.get('token').get('access_token'),
'Content-Type': 'application/json',
'Accept': 'application/json',
}
json_data = {}
r = requests.get("http://localhost:8080/ocs/v1.php/cloud/users/" + request.session.get('token').get('user_id'), data=json_data, headers=headers)
data = json.loads(r.text)
#print(data.get('ocs').get('data').get('displayname'))
request.user.first_name = data.get('ocs').get('data').get('displayname')
'''
# UPDATE FUNCTIONS BY NEW MODEL-CHANGES FOR COPIEN SOME DATA
toUpdate(request)