diff --git a/dasettings/templates/dasettings/modulesettings_timemanagement.html b/dasettings/templates/dasettings/modulesettings_timemanagement.html index 9d9f134..570c9e7 100644 --- a/dasettings/templates/dasettings/modulesettings_timemanagement.html +++ b/dasettings/templates/dasettings/modulesettings_timemanagement.html @@ -42,12 +42,17 @@

Externer Zugriff{% if request.user.profile.showtooltips %} {% endif %}

-
- + + {% if request.user.profile.agency.agencycal_publicstatus == 1 %} + Externer Zugriff erlaubt. + {% else %} + Externer Zugriff gesperrt. + {% endif %}
Feiertage bearbeiten @@ -56,13 +61,17 @@ + + {% endblock content %} diff --git a/dasettings/views.py b/dasettings/views.py index 622da83..ca8f6b1 100644 --- a/dasettings/views.py +++ b/dasettings/views.py @@ -1017,9 +1017,7 @@ def SettingsAjaxRouter(request): request.user.profile.agency.save() else: success = False - print("DER NICHT") - - + return JsonResponse({"success" : success, "data" : data}) else: success = False @@ -1027,7 +1025,7 @@ def SettingsAjaxRouter(request): def randomStringNum(stringLength=20): """Generate a random string of fixed length """ - lettersAndNumbers = string.ascii_lowercase + string.digits + lettersAndNumbers = string.ascii_lowercase + string.digits + string.ascii_uppercase return ''.join(random.choice(lettersAndNumbers) for i in range(stringLength)) @@ -1712,10 +1710,9 @@ class BillPlanUpdate(UpdateView): start_date = month start_date_string = month.strftime("%d.%m.%Y") - end_date = month + relativedelta(months=plan) + end_date = month + relativedelta(days=30) end_date_string= end_date.strftime("%d.%m.%Y") - voucher_date_today = date.today().strftime("%Y-%m-%d") # TASK: Was passiert bei Änderungen der Agenturdaten? diff --git a/dump.rdb b/dump.rdb index f31bf29..bf4df83 100644 Binary files a/dump.rdb and b/dump.rdb differ diff --git a/users/urls.py b/users/urls.py index 22cbace..c7a0864 100644 --- a/users/urls.py +++ b/users/urls.py @@ -42,7 +42,10 @@ urlpatterns = [ path('dacronbill/', views.cronactionsbill, name="cronmainbill"), path('isalive/', views.isAlive, name="isalive"), path('ics/', views.getICSFile, name="getics"), - path('icsall/', views.getICSFileAll, name="geticsall") + path('icsall/', views.getICSFileAll, name="geticsall"), + path('icspublic//', views.getICSFileEx, name="getics"), + path('icspublicall//', views.getICSFileExAll, name="geticsall"), + ] diff --git a/users/views.py b/users/views.py index 8aeaea2..7b01717 100644 --- a/users/views.py +++ b/users/views.py @@ -59,7 +59,6 @@ import base64 from django.contrib.auth import authenticate def getICSFile(request, ag): - #if request.user.profile.agency.pk == ag: if 'HTTP_AUTHORIZATION' in request.META: auth = request.META['HTTP_AUTHORIZATION'].split() if len(auth) == 2: @@ -94,7 +93,6 @@ def getICSFile(request, ag): def getICSFileAll(request, ag): - #if request.user.profile.agency.pk == ag: if 'HTTP_AUTHORIZATION' in request.META: auth = request.META['HTTP_AUTHORIZATION'].split() if len(auth) == 2: @@ -126,6 +124,60 @@ def getICSFileAll(request, ag): return response +def getICSFileEx(request, code, ag): + try: + agency = Agency.objects.get(pk=ag) + + if agency != None and agency.agencycal_publicstatus == 1 and code == agency.agencycalurl: + c = Calendar() + absencedays = Absence.objects.filter(agency=ag) + for ab in absencedays: + e = Event() + e.name = ab.user.first_name + " " + ab.user.last_name + " abwesend " + e.uid = "da-ab-" + str(ab.pk) + e.begin = ab.start + e.end = ab.end + e.allday = True + c.events.add(e) + return HttpResponse(c, content_type='text/calendar') + else: + realm = "" + response = HttpResponse() + response.status_code = 401 + return response + except: + realm = "" + response = HttpResponse() + response.status_code = 401 + return response + + +def getICSFileExAll(request, code, ag): + try: + agency = Agency.objects.get(pk=ag) + if agency != None and agency.agencycal_publicstatus == 1 and code == agency.agencycalurl_all: + c = Calendar() + absencedays = Absence.objects.filter(agency=ag) + for ab in absencedays: + e = Event() + e.name = ab.user.first_name + " " + ab.user.last_name + " | " + ab.reason.name + e.uid = "da-ab-" + str(ab.pk) + e.begin = ab.start + e.end = ab.end + e.allday = True + c.events.add(e) + return HttpResponse(c, content_type='text/calendar') + else: + realm = "" + response = HttpResponse() + response.status_code = 401 + return response + except: + realm = "" + response = HttpResponse() + response.status_code = 401 + return response + ''' @@ -212,7 +264,7 @@ def randomString(stringLength=10): def randomStringNum(stringLength=20): """Generate a random string of fixed length """ - lettersAndNumbers = string.ascii_lowercase + string.digits + lettersAndNumbers = string.ascii_lowercase + string.digits + string.ascii_uppercase return ''.join(random.choice(lettersAndNumbers) for i in range(stringLength)) @login_required