Kalender kann nun abonniert werden mit Authentifikation
This commit is contained in:
parent
f0d72785fc
commit
148bb6de9e
|
|
@ -11,4 +11,4 @@ urlpatterns = [
|
||||||
path('getchatrooms/', views.getchatrooms, name='api-getchatrooms'),
|
path('getchatrooms/', views.getchatrooms, name='api-getchatrooms'),
|
||||||
path('getsinglechat/<int:pk>', views.getsinglechat, name='api-getsinglechat'),
|
path('getsinglechat/<int:pk>', views.getsinglechat, name='api-getsinglechat'),
|
||||||
path('chatnewmessage/', views.savenewchatmessage, name='api-savechatmessage'),
|
path('chatnewmessage/', views.savenewchatmessage, name='api-savechatmessage'),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ from rest_framework import status
|
||||||
from rest_framework.authentication import SessionAuthentication, BasicAuthentication, TokenAuthentication
|
from rest_framework.authentication import SessionAuthentication, BasicAuthentication, TokenAuthentication
|
||||||
from rest_framework.decorators import authentication_classes
|
from rest_framework.decorators import authentication_classes
|
||||||
from chat.models import ChatRoom, ChatMessage
|
from chat.models import ChatRoom, ChatMessage
|
||||||
|
from django.http import HttpResponseRedirect,HttpResponse, JsonResponse
|
||||||
|
|
||||||
|
from timemanagement.models import Absence
|
||||||
|
|
||||||
class GetUserId(APIView):
|
class GetUserId(APIView):
|
||||||
permission_classes = (IsAuthenticated,) # <-- And here
|
permission_classes = (IsAuthenticated,) # <-- And here
|
||||||
|
|
@ -17,6 +20,7 @@ class GetUserId(APIView):
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
return Response({"userid" : self.request.user.pk})
|
return Response({"userid" : self.request.user.pk})
|
||||||
|
|
||||||
|
|
||||||
@api_view(['POST', ])
|
@api_view(['POST', ])
|
||||||
@permission_classes((IsAuthenticated,))
|
@permission_classes((IsAuthenticated,))
|
||||||
def getStandardList(request):
|
def getStandardList(request):
|
||||||
|
|
|
||||||
|
|
@ -794,7 +794,7 @@ $('.droppable_div').on('dragleave', function (e) {
|
||||||
});
|
});
|
||||||
//allowedtypes = "application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, text/plain, application/pdf, image/*, image/x-png, image/gif, image/jpg, image/jpeg, image/JPEG, image/JPG, docx, JPEG, JPG, doc, odt, ODT, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
//allowedtypes = "application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, text/plain, application/pdf, image/*, image/x-png, image/gif, image/jpg, image/jpeg, image/JPEG, image/JPG, docx, JPEG, JPG, doc, odt, ODT, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||||
|
|
||||||
allowedtypes = ['doc','docx','odt','ods','xls','xlsx','xlsm','ppt','pptx','mov','avi','svg','png','jpg','jpeg','mp3', 'wav', 'zip', 'rar', 'mp4', 'mwv', 'flv', 'eps', 'txt', 'pdf', "pages", "numbers"]
|
allowedtypes = ['doc','docx','odt','ods','xls','xlsx','xlsm','ppt','pptx','mov','avi','svg','png','jpg','jpeg','mp3', 'wav', 'zip', 'rar', 'mp4', 'mwv', 'flv', 'eps', 'txt', 'pdf', "pages", "numbers", "ics"]
|
||||||
|
|
||||||
|
|
||||||
function getFileExtension1(filename) {
|
function getFileExtension1(filename) {
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ def adddirbyajax(request, parent):
|
||||||
# VALIDATE FILE-TYPE
|
# VALIDATE FILE-TYPE
|
||||||
file_ext_arr = request.FILES['uploadedfile'].name.split(".")
|
file_ext_arr = request.FILES['uploadedfile'].name.split(".")
|
||||||
file_ext = file_ext_arr[len(file_ext_arr)-1]
|
file_ext = file_ext_arr[len(file_ext_arr)-1]
|
||||||
allowed_types = ["txt", "TXT", "png", "PNG", "jpeg", "JPEG", "jpg", "JPG", "PDF", "pdf", "csv", "CSV", "DOC", "doc", "DOCX", "docx", "ODT", "odt", "PPT", "ppt", "PPTX", "pptx", "XLS", "xls", "XLSX", "xlsx", "mov", "MOV", "SVG", "svg", "ZIP", "zip", "RAR", "rar", "EPS", "eps", "MP3", "mp3", "WAV", "wav", "avi", "AVI", "FLV", "flv", "MP4", "mp4", "PAGES", "pages", "NUMBERS", "numbers"]
|
allowed_types = ["txt", "TXT", "png", "PNG", "jpeg", "JPEG", "jpg", "JPG", "PDF", "pdf", "csv", "CSV", "DOC", "doc", "DOCX", "docx", "ODT", "odt", "PPT", "ppt", "PPTX", "pptx", "XLS", "xls", "XLSX", "xlsx", "mov", "MOV", "SVG", "svg", "ZIP", "zip", "RAR", "rar", "EPS", "eps", "MP3", "mp3", "WAV", "wav", "avi", "AVI", "FLV", "flv", "MP4", "mp4", "PAGES", "pages", "NUMBERS", "numbers", "ics", "ICS"]
|
||||||
file_ok = False
|
file_ok = False
|
||||||
|
|
||||||
for t in allowed_types:
|
for t in allowed_types:
|
||||||
|
|
|
||||||
|
|
@ -1741,10 +1741,10 @@ class BillPlanUpdate(UpdateView):
|
||||||
"taxConditions": {
|
"taxConditions": {
|
||||||
"taxType": "net"
|
"taxType": "net"
|
||||||
},
|
},
|
||||||
"paymentConditions": {
|
#"paymentConditions": {da
|
||||||
"paymentTermLabel": "Bitte zahlen Sie innerhalb von 14 Tagen.",
|
# "paymentTermLabel": "Bitte zahlen Sie innerhalb von 14 Tagen.",
|
||||||
"paymentTermDuration": 14,
|
# "paymentTermDuration": 14,
|
||||||
},
|
#},
|
||||||
"shippingConditions": {
|
"shippingConditions": {
|
||||||
#"shippingDate": voucher_date_today + "T00:00:00.000+00:00",
|
#"shippingDate": voucher_date_today + "T00:00:00.000+00:00",
|
||||||
"shippingType": "none"
|
"shippingType": "none"
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -92,9 +92,11 @@ INSTALLED_APPS = [
|
||||||
'channels',
|
'channels',
|
||||||
'channels_presence',
|
'channels_presence',
|
||||||
'simple_history',
|
'simple_history',
|
||||||
'captcha'
|
'captcha',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
|
@ -146,6 +148,7 @@ CHANNEL_LAYERS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ urlpatterns = [
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
||||||
|
|
||||||
# ERROR HANDLERS
|
# ERROR HANDLERS
|
||||||
handler404 = 'users.views.handler404'
|
handler404 = 'users.views.handler404'
|
||||||
handler500 = 'users.views.handler500'
|
handler500 = 'users.views.handler500'
|
||||||
Binary file not shown.
|
|
@ -904,7 +904,9 @@ def getAgencyBillStatus(agency):
|
||||||
return returnvalue
|
return returnvalue
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def getBaseURLIcsLink(agency):
|
||||||
|
return settings.BASE_URL + "/ics/" + str(agency.pk)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -225,6 +225,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal with all users for OnClick-Add-Absence -->
|
<!-- Modal with all users for OnClick-Add-Absence -->
|
||||||
{% if user|usergperm:"absencemanager" %}
|
{% if user|usergperm:"absencemanager" %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
<div class="content-section col-12">
|
<div class="content-section col-12">
|
||||||
<h3>Abwesenheiten{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Bearbeiten Sie hier Ihre Abwesenheiten." class="far fa-question-circle"></i></small>{% endif %}
|
<h3>Abwesenheiten{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Bearbeiten Sie hier Ihre Abwesenheiten." class="far fa-question-circle"></i></small>{% endif %}
|
||||||
<!--<small><i onclick="javascript:$('#youtubevideoinformation').modal('toggle');" class="far fa-play-circle"></i></small>-->
|
<!--<small><i onclick="javascript:$('#youtubevideoinformation').modal('toggle');" class="far fa-play-circle"></i></small>-->
|
||||||
|
|
||||||
|
<small><a href="#" onclick="javascript:$('#showICSLink').modal('toggle')"><i class="fas fa-calendar-alt" data-toggle="tooltip" data-placement="top" title="Fügen Sie Ihrem Kalender einen Link hinzu, um alle Abwesenheiten im Blick zu behalten." style="color: #000000;"></i></a></small>
|
||||||
|
|
||||||
|
|
||||||
<button class="btn btn-primary btn-sm" {% if user|usergperm:"absencemanager" %} onclick="javascript:showNewAbsenceByUser()" {% else %} onclick="javascript:loadNewAbsenceByUser({{request.user.pk}})" {% endif %} style="float: right;" id="newabscencebtn"><i class="fas fa-plus"></i> Abwesenheit</button>
|
<button class="btn btn-primary btn-sm" {% if user|usergperm:"absencemanager" %} onclick="javascript:showNewAbsenceByUser()" {% else %} onclick="javascript:loadNewAbsenceByUser({{request.user.pk}})" {% endif %} style="float: right;" id="newabscencebtn"><i class="fas fa-plus"></i> Abwesenheit</button>
|
||||||
</h3>
|
</h3>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
@ -191,6 +195,32 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="modal fade" tabindex="-1" id="showICSLink" data-backdrop="static">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">ICS-Kalenderlink</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
Kopieren Sie diesen Link in Ihren Kalender und abonnieren den Abwesenheitskalender Ihrer Agentur: <br />
|
||||||
|
{% getBaseURLIcsLink request.user.profile.agency as icsurl %}
|
||||||
|
<b>{{icsurl}}</b>
|
||||||
|
<a href="#\" onclick="javascript:copyURL('{{icsurl}}')"><i class="far fa-copy"></i></a>
|
||||||
|
<span id="icsurl" style="display: none;">Kopiert!</span>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-primary " data-dismiss="modal">Schließen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- MODAL -->
|
<!-- MODAL -->
|
||||||
<div class="modal fade" tabindex="-1" id="updateAbsenceToConfirm" data-backdrop="static">
|
<div class="modal fade" tabindex="-1" id="updateAbsenceToConfirm" data-backdrop="static">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
|
|
@ -312,6 +342,15 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
|
function copyURL(urldata){
|
||||||
|
var $temp = $("<input>");
|
||||||
|
$("body").append($temp);
|
||||||
|
$temp.val(urldata).select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
$temp.remove();
|
||||||
|
$("#icsurl").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var absencetowork = "";
|
var absencetowork = "";
|
||||||
var absencestring_confirm = "";
|
var absencestring_confirm = "";
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@
|
||||||
<a style="color: #999; text-decoration: none;" href="https://digitale-agentur.com/impressum" target="_blank">Impressum</a>
|
<a style="color: #999; text-decoration: none;" href="https://digitale-agentur.com/impressum" target="_blank">Impressum</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
Version 1.0.1
|
Version 1.0.2
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<a href="https://www.myvve.de/" target="_blank"><img src="{% static 'users/img/VVE-Logo.png' %}" width="27%" class="mb-2"></a>
|
<a href="https://www.myvve.de/" target="_blank"><img src="{% static 'users/img/VVE-Logo.png' %}" width="27%" class="mb-2"></a>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ urlpatterns = [
|
||||||
path('dacron/<slug:code>', views.cronactions, name="cronmain"),
|
path('dacron/<slug:code>', views.cronactions, name="cronmain"),
|
||||||
path('dacrondaily/<slug:code>', views.cronactionsdaily, name="cronmaindaily"),
|
path('dacrondaily/<slug:code>', views.cronactionsdaily, name="cronmaindaily"),
|
||||||
path('dacronbill/<slug:code>', views.cronactionsbill, name="cronmainbill"),
|
path('dacronbill/<slug:code>', views.cronactionsbill, name="cronmainbill"),
|
||||||
path('isalive/', views.isAlive, name="isalive")
|
path('isalive/', views.isAlive, name="isalive"),
|
||||||
|
path('ics/<int:ag>', views.getICSFile, name="getics")
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,43 @@ from django.core.exceptions import ObjectDoesNotExist
|
||||||
from organizer.models import QuickLinks
|
from organizer.models import QuickLinks
|
||||||
from areas.models import Areas
|
from areas.models import Areas
|
||||||
from tasks.models import Tasks
|
from tasks.models import Tasks
|
||||||
|
|
||||||
|
''' ICS '''
|
||||||
|
from ics import Calendar, Event
|
||||||
|
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:
|
||||||
|
if auth[0].lower() == "basic":
|
||||||
|
temp = base64.b64decode(auth[1] + "==")
|
||||||
|
username = temp.decode("utf-8").split(":")[0]
|
||||||
|
passwd = temp.decode("utf-8").split(":")[1]
|
||||||
|
user = authenticate(username=username, password=passwd)
|
||||||
|
if user is not None:
|
||||||
|
if user.is_active:
|
||||||
|
if user.profile.agency.pk == ag:
|
||||||
|
request.user = user
|
||||||
|
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
|
||||||
|
c.events.add(e)
|
||||||
|
return HttpResponse(c, content_type='text/calendar')
|
||||||
|
|
||||||
|
realm = ""
|
||||||
|
response = HttpResponse()
|
||||||
|
response.status_code = 401
|
||||||
|
response['WWW-Authenticate'] = 'Basic realm="%s"' % realm
|
||||||
|
return response
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
Standardstruktur laden
|
Standardstruktur laden
|
||||||
|
|
@ -1487,10 +1524,10 @@ def cronactionsbill(request, code):
|
||||||
"taxConditions": {
|
"taxConditions": {
|
||||||
"taxType": "net"
|
"taxType": "net"
|
||||||
},
|
},
|
||||||
"paymentConditions": {
|
#"paymentConditions": {
|
||||||
"paymentTermLabel": "Bitte zahlen Sie innerhalb von 14 Tagen.",
|
# "paymentTermLabel": "Bitte zahlen Sie innerhalb von 14 Tagen.",
|
||||||
"paymentTermDuration": 14,
|
# "paymentTermDuration": 14,
|
||||||
},
|
#},
|
||||||
"shippingConditions": {
|
"shippingConditions": {
|
||||||
#"shippingDate": voucher_date_today + "T00:00:00.000+00:00",
|
#"shippingDate": voucher_date_today + "T00:00:00.000+00:00",
|
||||||
"shippingType": "none"
|
"shippingType": "none"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue